mercurial/util.py
changeset 7123 716277f5867e
parent 7118 619ebf82cef2
child 7137 0c63b87d9bce
--- a/mercurial/util.py	Sat Oct 18 14:43:20 2008 +0200
+++ b/mercurial/util.py	Sat Oct 18 15:49:15 2008 +0200
@@ -51,18 +51,22 @@
 
 try:
     import subprocess
+    closefds = os.name == 'posix'
     def popen2(cmd, mode='t', bufsize=-1):
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
+        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
+                             close_fds=closefds,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE)
         return p.stdin, p.stdout
     def popen3(cmd, mode='t', bufsize=-1):
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
+        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
+                             close_fds=closefds,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)
         return p.stdin, p.stdout, p.stderr
     def Popen3(cmd, capturestderr=False, bufsize=-1):
         stderr = capturestderr and subprocess.PIPE or None
-        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
+        p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
+                             close_fds=closefds,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                              stderr=stderr)
         p.fromchild = p.stdout