Skip to content

Commit d84247d

Browse files
committed
(kbuild.jinja2) Get return code properly
In Python, os.system() returns the exit status in a platform-specific format. On Unix-like systems, it returns the exit status shifted left by 8 bits. Here's what's happening: - My shell script exits with code 1 (build failure) - os.system() returns 256 (1 << 8) Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 82eeb2b commit d84247d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

config/runtime/kbuild.jinja2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from kernelci.kbuild import KBuild
1313
import os
1414
import sys
15+
import subprocess
16+
1517
{%- endblock %}
1618

1719
{%- block python_globals %}
@@ -61,10 +63,11 @@ def main(args):
6163
build.set_storage_config(STORAGE_CONFIG_YAML)
6264
build.write_script("build.sh")
6365
build.serialize("_build.json")
64-
r = os.system("bash -e build.sh")
66+
result = subprocess.run(["bash", "-e", "build.sh"])
67+
exit_code = result.returncode
6568
build2 = KBuild.from_json("_build.json")
6669
build2.verify_build()
67-
results = build2.submit(r)
70+
results = build2.submit(exit_code)
6871
return results
6972

7073
{% endblock %}

0 commit comments

Comments
 (0)