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

Torben Hohn torben.hohn at linutronix.de
Wed Jun 26 16:31:28 CEST 2019


On Wed, Jun 26, 2019 at 10:40:06AM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list