aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorRoman Lacko <backup.rlacko@gmail.com>2013-03-25 11:03:10 +0100
committerRoman Lacko <backup.rlacko@gmail.com>2013-03-25 11:03:10 +0100
commita38b9ddeffa0524d467b5b90b3c8e29925c1a375 (patch)
tree90955b85fa1447600612c4c807cebcf3e433aed3 /utils.py
parent945b5abe8655b390ec430b1300ecfbb58b86eacf (diff)
Show info about the running process in log
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/utils.py b/utils.py
index c03f31f7c..1722fe6fa 100644
--- a/utils.py
+++ b/utils.py
@@ -166,14 +166,7 @@ def rmtree(dirname):
def run_process(args, logger=None):
- if sys.platform != "win32":
- try:
- spawn(args)
- return 0
- except DistutilsExecError:
- return -1
-
- def log(buffer, checkNewLine):
+ def log(buffer, checkNewLine=False):
endsWithNewLine = False
if buffer.endswith('\n'):
endsWithNewLine = True
@@ -191,6 +184,15 @@ def run_process(args, logger=None):
print(line.rstrip('\r'))
return buffer
+ log("Running process: {0}".format(" ".join([(" " in x and '"{0}"'.format(x) or x) for x in args])))
+
+ if sys.platform != "win32":
+ try:
+ spawn(args)
+ return 0
+ except DistutilsExecError:
+ return -1
+
shell = False
if sys.platform == "win32":
shell = True
@@ -205,9 +207,9 @@ def run_process(args, logger=None):
log_buffer = None;
while proc.poll() is None:
- log_buffer = log(proc.read_async(wait=0.1, e=0), False)
+ log_buffer = log(proc.read_async(wait=0.1, e=0))
if log_buffer:
- log(log_buffer, False)
+ log(log_buffer)
proc.wait()
return proc.returncode