@@ -93,17 +115,30 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root='/'):
if type(stderr) == type("string"):
stderr = open(stderr, "w")
+ runningLog = open("/tmp/program.log", "a")
+ runningLog.write("Running... %s\n" % ([command] + argv,))
+
try:
- pipe = subprocess.Popen([command] + argv, stdin=stdin,
+ proc = subprocess.Popen([command] + argv, stdin=stdin,
stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
+ stderr=subprocess.PIPE,
preexec_fn=chroot, cwd=root)
+
+ while True:
+ (outStr, errStr) = proc.communicate()
+ if outStr:
+ runningLog.write(outStr)
+ rc += outStr
+ if errStr:
+ runningLog.write(errStr)
+ rc += errStr