diff options
author | comex | 2015-07-17 16:55:31 -0400 |
---|---|---|
committer | comex | 2015-07-17 16:55:31 -0400 |
commit | cca400779a2b37b119e87b6cf8a1e1c364f22466 (patch) | |
tree | 5bb2cea22c45177c98358cbc95bfd3dc99d2d3fc | |
parent | fix iOS detection properly. (diff) | |
download | substitute-cca400779a2b37b119e87b6cf8a1e1c364f22466.tar.gz |
show the name of slow commands
Diffstat (limited to '')
-rw-r--r-- | script/mconfig.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/script/mconfig.py b/script/mconfig.py index b4c8ba2..1afcd0d 100644 --- a/script/mconfig.py +++ b/script/mconfig.py @@ -55,13 +55,24 @@ def init_config_log(): # a wrapper for subprocess that logs results # returns (stdout, stderr, status) [even if Popen fails] def run_command(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs): - config_log.write("Running command '%s'\n" % (argv_to_shell(cmd),)) + shell = argv_to_shell(cmd) + config_log.write("Running command '%s'\n" % (shell,)) + + isatty = sys.stdout.isatty() + if isatty: + sys.stdout.write('>>> ' + shell) # no \n + sys.stdout.flush() + try: p = subprocess.Popen(cmd, stdout=stdout, stderr=stderr, **kwargs) except OSError: config_log.write(' OSError\n') return '', '', 127 so, se = [o.decode('utf-8') for o in p.communicate()] + + if isatty: + sys.stdout.write('\033[2K\r') + if p.returncode != 0: config_log.write(' failed with status %d\n' % (p.returncode,)) config_log.write('-----------\n') |