# HG changeset patch # User Patrick Mezard # Date 2008-10-23 13:35:54 # Node ID b340cb536893b7c0be152f8feffe25c1c9b987f7 # Parent 1f07e2e86974f8bf03706d9c40833b2eb687fd23 util: add 'mode' argument to popen() diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1044,12 +1044,12 @@ if os.name == 'nt': # through the current COMSPEC. cmd.exe suppress enclosing quotes. return '"' + cmd + '"' - def popen(command): + def popen(command, mode='r'): # 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)) + return os.popen(quotecommand(command), mode) def explain_exit(code): return _("exited with status %d") % code, code @@ -1212,8 +1212,8 @@ else: def quotecommand(cmd): return cmd - def popen(command): - return os.popen(command) + def popen(command, mode='r'): + return os.popen(command, mode) def testpid(pid): '''return False if pid dead, True if running or not sure'''