From: Chuck Lever Date: Wed, 26 Oct 2005 18:51:58 +0000 (-0400) Subject: Prevent stderr from appearing on stdout when running commands X-Git-Tag: v0.8~45 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/741f278499bbb039814789c0d11639c71512df92?hp=f8fb574771b75e3e4a96b7d48177cda55f681a1b Prevent stderr from appearing on stdout when running commands The original purpose was to eliminate "fatal: Needed single revision" when a ref didn't exist, but this seems like an overall good thing to do to help with output cleanliness.. Signed-off-by: Chuck Lever --- diff --git a/stgit/git.py b/stgit/git.py index 6b7eb83..25d9483 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -114,7 +114,7 @@ def get_conflicts(): return None def _input(cmd, file_desc): - p = popen2.Popen3(cmd) + p = popen2.Popen3(cmd, True) while True: line = file_desc.readline() if not line: @@ -125,14 +125,14 @@ def _input(cmd, file_desc): raise GitException, '%s failed' % str(cmd) def _output(cmd): - p=popen2.Popen3(cmd) + p=popen2.Popen3(cmd, True) string = p.fromchild.read() if p.wait(): raise GitException, '%s failed' % str(cmd) return string def _output_one_line(cmd, file_desc = None): - p=popen2.Popen3(cmd) + p=popen2.Popen3(cmd, True) if file_desc != None: for line in file_desc: p.tochild.write(line) @@ -143,7 +143,7 @@ def _output_one_line(cmd, file_desc = None): return string def _output_lines(cmd): - p=popen2.Popen3(cmd) + p=popen2.Popen3(cmd, True) lines = p.fromchild.readlines() if p.wait(): raise GitException, '%s failed' % str(cmd)