Skip to content

Commit

Permalink
add py3.10 fix for start_unix_server
Browse files Browse the repository at this point in the history
  • Loading branch information
goneri committed May 14, 2021
1 parent 730fdc5 commit a37c8ce
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions plugins/module_utils/turbo/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,20 @@ def start(self):
self.loop.add_signal_handler(signal.SIGTERM, self.stop)
self._watcher = self.loop.create_task(self.ghost_killer())

self.loop.create_task(
asyncio.start_unix_server(
self.handle, path=self.socket_path, loop=self.loop
import sys
if sys.hexversion >= 0x30a00b1:
# py3.10 drops the loop argument of create_task.
self.loop.create_task(
asyncio.start_unix_server(
self.handle, path=self.socket_path
)
)
else:
self.loop.create_task(
asyncio.start_unix_server(
self.handle, path=self.socket_path, loop=self.loop
)
)
)
self.loop.run_forever()

def stop(self):
Expand Down

0 comments on commit a37c8ce

Please sign in to comment.