Mercurial > hg-stable
changeset 7123:716277f5867e
util: subprocess close_fds option is unix only
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 18 Oct 2008 15:49:15 +0200 |
parents | 3cf699e89e48 |
children | 63579aa36c8e |
files | mercurial/util.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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