summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/asyncrpc/client.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/bitbake/lib/bb/asyncrpc/client.py b/bitbake/lib/bb/asyncrpc/client.py
index 881434d2e9..fa042bbe87 100644
--- a/bitbake/lib/bb/asyncrpc/client.py
+++ b/bitbake/lib/bb/asyncrpc/client.py
@@ -31,7 +31,17 @@ class AsyncClient(object):
31 31
32 async def connect_unix(self, path): 32 async def connect_unix(self, path):
33 async def connect_sock(): 33 async def connect_sock():
34 return await asyncio.open_unix_connection(path) 34 # AF_UNIX has path length issues so chdir here to workaround
35 cwd = os.getcwd()
36 try:
37 os.chdir(os.path.dirname(path))
38 # The socket must be opened synchronously so that CWD doesn't get
39 # changed out from underneath us so we pass as a sock into asyncio
40 sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
41 sock.connect(os.path.basename(path))
42 finally:
43 os.chdir(cwd)
44 return await asyncio.open_unix_connection(sock=sock)
35 45
36 self._connect_sock = connect_sock 46 self._connect_sock = connect_sock
37 47
@@ -150,14 +160,8 @@ class Client(object):
150 setattr(self, m, self._get_downcall_wrapper(downcall)) 160 setattr(self, m, self._get_downcall_wrapper(downcall))
151 161
152 def connect_unix(self, path): 162 def connect_unix(self, path):
153 # AF_UNIX has path length issues so chdir here to workaround 163 self.loop.run_until_complete(self.client.connect_unix(path))
154 cwd = os.getcwd() 164 self.loop.run_until_complete(self.client.connect())
155 try:
156 os.chdir(os.path.dirname(path))
157 self.loop.run_until_complete(self.client.connect_unix(os.path.basename(path)))
158 self.loop.run_until_complete(self.client.connect())
159 finally:
160 os.chdir(cwd)
161 165
162 @property 166 @property
163 def max_chunk(self): 167 def max_chunk(self):