Skip to contentSkip to conversation

lib/bb/server: Avoid UnboundLocalError traceback

PATCH New Richard Purdie 1 participant 1 message Nov 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bb/server: Avoid UnboundLocalError traceback

Traceback (most recent call last):
File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
server_connection = bb.server.process.connectProcessServer(sockname, featureset)
File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/server/process.py", line 490, in connectProcessServer
if command_chan_recv:
UnboundLocalError: local variable 'command_chan_recv' referenced before assignment

---
 lib/bb/server/process.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/server/process.py +3 -3
index ed930c61f4..0cae41cf86 100644
@@ -452,6 +452,9 @@ def connectProcessServer(sockname, featureset):
     # AF_UNIX has path length issues so chdir here to workaround
     cwd = os.getcwd()
 
+    readfd = writefd = readfd1 = writefd1 = readfd2 = writefd2 = None
+    eq = command_chan_recv = command_chan = None
+
     try:
         try:
             os.chdir(os.path.dirname(sockname))
@@ -459,9 +462,6 @@ def connectProcessServer(sockname, featureset):
         finally:
             os.chdir(cwd)
 
-        readfd = writefd = readfd1 = writefd1 = readfd2 = writefd2 = None
-        eq = command_chan_recv = command_chan = None
-
         # Send an fd for the remote to write events to
         readfd, writefd = os.pipe()
         eq = BBUIEventQueue(readfd)
Signature · 1 line
2.17.1