Skip to contentSkip to conversation

lib/oe/package: Improve strip subprocess handling

PATCH New Richard Purdie 1 participant 1 message Apr 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/oe/package: Improve strip subprocess handling

Currently if the strip process fails, we get a message but don't know why. This adds code to show the return value and any error output.

meta/lib/oe/package.py +4 -4
index ea6feaa..f176446 100644
@@ -33,14 +33,14 @@ def runstrip(arg):
     stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
     bb.debug(1, "runstrip: %s" % stripcmd)
 
-    ret = subprocess.call(stripcmd, shell=True)
+    try:
+        output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT, shell=True)
+    except subprocess.CalledProcessError as e:
+        bb.error("runstrip: '%s' strip command failed with %s (%s)" % (stripcmd, e.returncode, e.output))
 
     if newmode:
         os.chmod(file, origmode)
 
-    if ret:
-        bb.error("runstrip: '%s' strip command failed" % stripcmd)
-
     return