##// END OF EJS Templates
util: subprocess close_fds option is unix only
Patrick Mezard -
r7123:716277f5 default
parent child Browse files
Show More
@@ -51,18 +51,22 b' def sha1(s):'
51
51
52 try:
52 try:
53 import subprocess
53 import subprocess
54 closefds = os.name == 'posix'
54 def popen2(cmd, mode='t', bufsize=-1):
55 def popen2(cmd, mode='t', bufsize=-1):
55 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
56 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
57 close_fds=closefds,
56 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
58 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
57 return p.stdin, p.stdout
59 return p.stdin, p.stdout
58 def popen3(cmd, mode='t', bufsize=-1):
60 def popen3(cmd, mode='t', bufsize=-1):
59 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
61 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
62 close_fds=closefds,
60 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
63 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
61 stderr=subprocess.PIPE)
64 stderr=subprocess.PIPE)
62 return p.stdin, p.stdout, p.stderr
65 return p.stdin, p.stdout, p.stderr
63 def Popen3(cmd, capturestderr=False, bufsize=-1):
66 def Popen3(cmd, capturestderr=False, bufsize=-1):
64 stderr = capturestderr and subprocess.PIPE or None
67 stderr = capturestderr and subprocess.PIPE or None
65 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, close_fds=True,
68 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
69 close_fds=closefds,
66 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
70 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
67 stderr=stderr)
71 stderr=stderr)
68 p.fromchild = p.stdout
72 p.fromchild = p.stdout
General Comments 0
You need to be logged in to leave comments. Login now