summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/asyncrpc/client.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/bitbake/lib/bb/asyncrpc/client.py b/bitbake/lib/bb/asyncrpc/client.py
index 881434d2e95..f4c7fdd829c 100644
--- a/bitbake/lib/bb/asyncrpc/client.py
+++ b/bitbake/lib/bb/asyncrpc/client.py
@@ -31,7 +31,20 @@ class AsyncClient(object):
async def connect_unix(self, path):
async def connect_sock():
- return await asyncio.open_unix_connection(path)
+ cwd = os.getcwd()
+ try:
+ # AF_UNIX has path length issues so chdir here to workaround.
+ # This also means that the socket must be opened synchronously
+ # so that CWD doesn't get changed out from underneath us, but
+ # connections are rare enough it probably doesn
+ os.chdir(os.path.dirname(path))
+
+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ sock.connect(os.path.basename(path))
+ finally:
+ os.chdir(cwd)
+
+ return await asyncio.open_unix_connection(sock=sock)
self._connect_sock = connect_sock
@@ -150,14 +163,8 @@ class Client(object):
setattr(self, m, self._get_downcall_wrapper(downcall))
def connect_unix(self, path):
- # AF_UNIX has path length issues so chdir here to workaround
- cwd = os.getcwd()
- try:
- os.chdir(os.path.dirname(path))
- self.loop.run_until_complete(self.client.connect_unix(os.path.basename(path)))
- self.loop.run_until_complete(self.client.connect())
- finally:
- os.chdir(cwd)
+ self.loop.run_until_complete(self.client.connect_unix(path))
+ self.loop.run_until_complete(self.client.connect())
@property
def max_chunk(self):