[elbe-devel] [PATCH v3 02/15] Change os.sytem to shellhelper::system for "chroot.py"

dion at linutronix.de dion at linutronix.de
Wed Jun 26 10:40:06 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/chroot.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/chroot.py b/elbepack/commands/chroot.py
index 7529fcf7..a65d27e6 100644
--- a/elbepack/commands/chroot.py
+++ b/elbepack/commands/chroot.py
@@ -14,6 +14,7 @@ import os
 
 from elbepack.elbeproject import ElbeProject
 from elbepack.elbexml import ValidationError, ValidationMode
+from elbepack.shellhelper import system, CommandError
 
 
 def run_command(argv):
@@ -61,8 +62,14 @@ def run_command(argv):
             cmd += (c + " ")
 
     if opt.target:
-        with project.targetfs:
-            os.system("/usr/sbin/chroot %s %s" % (project.targetpath, cmd))
+        try:
+            with project.targetfs:
+                system("/usr/sbin/chroot %s %s" % (project.targetpath, cmd))
+        except CommandError as e:
+            print(repr(e))
     else:
-        with project.buildenv:
-            os.system("/usr/sbin/chroot %s %s" % (project.chrootpath, cmd))
+        try:
+            with project.buildenv:
+                system("/usr/sbin/chroot %s %s" % (project.chrootpath, cmd))
+        except CommandError as e:
+            print(repr(e))
-- 
2.11.0




More information about the elbe-devel mailing list