diff options
author | Papoteur <papoteur@mageialinux-online.org> | 2015-11-30 22:55:27 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageialinux-online.org> | 2015-11-30 22:55:27 +0100 |
commit | 02497158514ea0f6a8ebd509ea3f09a2767fc2d1 (patch) | |
tree | c8414ca5a86e6b09dc2fe0e2abfc90bb4b457ae3 /MgaRepo/util.py | |
parent | 6507f60a1b99d049178ca54cd8dc996faaae44b8 (diff) | |
download | mgarepo-02497158514ea0f6a8ebd509ea3f09a2767fc2d1.tar mgarepo-02497158514ea0f6a8ebd509ea3f09a2767fc2d1.tar.gz mgarepo-02497158514ea0f6a8ebd509ea3f09a2767fc2d1.tar.bz2 mgarepo-02497158514ea0f6a8ebd509ea3f09a2767fc2d1.tar.xz mgarepo-02497158514ea0f6a8ebd509ea3f09a2767fc2d1.zip |
Print the command to exec in verbose mode
Diffstat (limited to 'MgaRepo/util.py')
-rw-r--r-- | MgaRepo/util.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/MgaRepo/util.py b/MgaRepo/util.py index 75073ee..ba3e0d6 100644 --- a/MgaRepo/util.py +++ b/MgaRepo/util.py @@ -28,10 +28,13 @@ def commands_getstatusoutput(cmd): def execcmd(*cmd, **kwargs): cmdstr = " ".join(cmd) + verbose = config.getbool("global", "verbose", 0) if kwargs.get('info'): prefix='LANGUAGE=C LC_TIME=C ' else: prefix='LANG=C LANGUAGE=C LC_ALL=C ' + if verbose: + print(prefix + cmdstr) if kwargs.get("show"): if kwargs.get("geterr"): err = StringIO() @@ -61,14 +64,12 @@ def execcmd(*cmd, **kwargs): output = "" else: status, output = commands_getstatusoutput(prefix + cmdstr) - verbose = config.getbool("global", "verbose", 0) if status != 0 and not kwargs.get("noerror"): if kwargs.get("cleanerr") and not verbose: raise Error(output) else: raise Error("command failed: %s\n%s\n" % (cmdstr, output)) if verbose: - print(output) sys.stdout.write(output) return status, output |