# HG changeset patch # User Patrick Mezard # Date 1224337755 -7200 # Node ID 716277f5867e8380c4373aedd411561f2fe9203e # Parent 3cf699e89e48f1ebffd4258b5f949f961882f138 util: subprocess close_fds option is unix only diff -r 3cf699e89e48 -r 716277f5867e mercurial/util.py --- 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