better handling of stdout

This commit is contained in:
James Slagle 2014-02-04 10:31:47 -05:00
parent 5c382202f7
commit 64dee75762

View File

@ -159,8 +159,7 @@ class ElementRunner(object):
logging.info("Blacklisting %s" % blacklisted_script)
os.unlink(os.path.join(hook_dir, blacklisted_script))
rc, stdout = call(['dib-run-parts', hook_dir],
stdout=sys.stdout, stderr=sys.stderr,
rc = call(['dib-run-parts', hook_dir],
env=os.environ)
if rc != 0:
@ -183,16 +182,11 @@ def call(command, **kwargs):
logging.info('executing command: %s' % command)
p = subprocess.Popen(command,
stdout=sys.stdout,
stderr=sys.stderr,
**kwargs)
rc = p.wait()
if p.stdout:
stdout = p.stdout.read()
print(stdout)
else:
stdout = None
logging.info(' exited with code: %s' % rc)
return rc, stdout
return rc