[projects/pld-builder.new] chroot, build: return the exit code of a command, not its wait status
arekm
arekm at pld-linux.org
Mon Oct 26 17:17:51 CET 2026
commit 1e569eed95a39ee911779c631840ba94cd512567
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Oct 24 18:26:05 2026 +0200
chroot, build: return the exit code of a command, not its wait status
os.popen().close() shifts the exit code left by 8 bits, so a failed
src.rpm build was logged as "exit status 256". Callers only test for
non-zero, which a signal still gives.
PLD_Builder/build.py | 4 ++--
PLD_Builder/chroot.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/PLD_Builder/build.py b/PLD_Builder/build.py
index 055b02e..a40a0fb 100644
--- a/PLD_Builder/build.py
+++ b/PLD_Builder/build.py
@@ -40,8 +40,8 @@ def run_command(batch):
r = f.close()
if r == None:
return 0
- else:
- return r
+ # close() gives the exit code shifted left by 8 bits, negative for a signal
+ return r >> 8
else:
user = "root"
if "as-builder" in batch.command_flags:
diff --git a/PLD_Builder/chroot.py b/PLD_Builder/chroot.py
index 7b98c88..87f6f7f 100644
--- a/PLD_Builder/chroot.py
+++ b/PLD_Builder/chroot.py
@@ -66,8 +66,8 @@ def run(cmd, user = "builder", logfile = None, logstdout = None, nonet=True):
r = f.close()
if r == None:
return 0
- else:
- return r
+ # close() gives the exit code shifted left by 8 bits, negative for a signal
+ return r >> 8
def cp(file, outfile, user="builder", rm=False):
cmd = "cat %s" % file
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/ce9feb3c796ed049b6dd260a50d94d80feb1656d
More information about the pld-cvs-commit
mailing list