]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: build.py: fix os.getcwd() exception
authorJuro Bystricky <juro.bystricky@intel.com>
Mon, 26 Sep 2016 20:53:13 +0000 (13:53 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 28 Sep 2016 09:17:13 +0000 (10:17 +0100)
When trying to obtain the current directory from a directory
that does not exist anymore, an exception is raised.
This patch handles such exception.

[YOCTO #10331]

(Bitbake rev: 4bcf77589312d9936340d8c308006c2fc9baf67c)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/build.py

index 2ed0441b4916f16f8485143b7a7d849e2763ab57..249f7d6bb44d7dbd4f792f4bb618998aa33ec55f 100644 (file)
@@ -261,9 +261,14 @@ def exec_func(func, d, dirs = None, pythonexception=False):
         else:
             exec_func_shell(func, d, runfile, cwd=adir)
 
-    if oldcwd and os.getcwd() != oldcwd:
+    try:
+        curcwd = os.getcwd()
+    except:
+        curcwd = None
+
+    if oldcwd and curcwd != oldcwd:
         try:
-            bb.warn("Task %s changed cwd to %s" % (func, os.getcwd()))
+            bb.warn("Task %s changed cwd to %s" % (func, curcwd))
             os.chdir(oldcwd)
         except:
             pass