Mercurial > hg > mercurial-crew
diff mercurial/util.py @ 5488:003d1f174fe1
Fix Windows os.popen bug with interleaved stdout/stderr output
See python bug 1366 "popen spawned process may not write to stdout under windows" for more details.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 01 Nov 2007 12:05:14 +0100 |
parents | f2ca8d2c988f |
children | 7a64931e2d76 |
line wrap: on
line diff
--- a/mercurial/util.py +++ b/mercurial/util.py @@ -1011,6 +1011,13 @@ # through the current COMSPEC. cmd.exe suppress enclosing quotes. return '"' + cmd + '"' + def popen(command): + # Work around "popen spawned process may not write to stdout + # under windows" + # http://bugs.python.org/issue1366 + command += " 2> %s" % nulldev + return os.popen(quotecommand(command)) + def explain_exit(code): return _("exited with status %d") % code, code @@ -1168,6 +1175,9 @@ def quotecommand(cmd): return cmd + def popen(command): + return os.popen(command) + def testpid(pid): '''return False if pid dead, True if running or not sure''' if os.sys.platform == 'OpenVMS':