From 360e791b92a37bd0b96a161f923de238ac1c656b Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Sun, 17 Nov 2024 23:10:26 +0200 Subject: [PATCH] fix: sh retcode from the last real build plan shell command --- package.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package.py b/package.py index 20f19ff3..dfdbb65b 100644 --- a/package.py +++ b/package.py @@ -943,7 +943,15 @@ def execute(self, build_plan, zip_stream, query): with tempfile.NamedTemporaryFile(mode="w+t", delete=True) as temp_file: path, script = action[1:] # NOTE: Execute `pwd` to determine the subprocess shell's working directory after having executed all other commands. - script = f"{script}\npwd >{temp_file.name}" + script = "\n".join( + ( + script, + "retcode=$?", + f"pwd >{temp_file.name}", + "exit $retcode", + ) + ) + p = subprocess.Popen( script, shell=True,