util: add 'mode' argument to popen()
authorPatrick Mezard <pmezard@gmail.com>
Thu, 23 Oct 2008 15:35:54 +0200
changeset 7221 b340cb536893
parent 7188 1f07e2e86974
child 7222 c1dc903dc7b6
util: add 'mode' argument to popen()
mercurial/util.py
--- a/mercurial/util.py	Mon Oct 20 14:57:56 2008 +0200
+++ b/mercurial/util.py	Thu Oct 23 15:35:54 2008 +0200
@@ -1044,12 +1044,12 @@
         # 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 @@
     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'''