diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2010-07-07 21:40:51 +0200 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2010-07-07 21:43:45 +0200 |
commit | a2cc62702fb5d6b54aa68c4a4ed2bf300e582b31 (patch) | |
tree | 532760b1a1b28c739ebafc95e6a0d1b690f89d4f /layman | |
parent | 8eff1545b83aafba80074951829f6325199a5b25 (diff) | |
download | layman-a2cc62702fb5d6b54aa68c4a4ed2bf300e582b31.tar.gz layman-a2cc62702fb5d6b54aa68c4a4ed2bf300e582b31.tar.bz2 layman-a2cc62702fb5d6b54aa68c4a4ed2bf300e582b31.zip |
Close stdin of child processes in quiet mode
Diffstat (limited to 'layman')
-rw-r--r-- | layman/overlays/source.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/layman/overlays/source.py b/layman/overlays/source.py index 621cf4c..9836526 100644 --- a/layman/overlays/source.py +++ b/layman/overlays/source.py @@ -130,20 +130,30 @@ class OverlaySource(object): OUT.info('Running... # %s' % command_repr, 2) if self.quiet: + input_source = subprocess.PIPE output_target = open('/dev/null', 'w') else: - output_target = None # i.e. re-use parent file descriptors + # Re-use parent file descriptors + input_source = None + output_target = None proc = subprocess.Popen(args, + stdin=input_source, stdout=output_target, stderr=output_target, cwd=cwd, env=env) if self.quiet: + # Make child non-interactive + proc.stdin.close() + + result = proc.wait() + + if self.quiet: output_target.close() - return proc.wait() + return result def to_xml_hook(self, repo_elem): pass |