##// END OF EJS Templates
util: always use subprocess
Martin Geisler -
r8280:0b02d98d default
parent child Browse files
Show More
@@ -44,9 +44,7 b' def sha1(s):'
44 _sha1 = sha.sha
44 _sha1 = sha.sha
45 return _sha1(s)
45 return _sha1(s)
46
46
47 try:
48 import subprocess
47 import subprocess
49 subprocess.Popen # trigger ImportError early
50 closefds = os.name == 'posix'
48 closefds = os.name == 'posix'
51 def popen2(cmd, mode='t', bufsize=-1):
49 def popen2(cmd, mode='t', bufsize=-1):
52 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
50 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
@@ -69,12 +67,6 b' try:'
69 p.tochild = p.stdin
67 p.tochild = p.stdin
70 p.childerr = p.stderr
68 p.childerr = p.stderr
71 return p
69 return p
72 except ImportError:
73 subprocess = None
74 from popen2 import Popen3
75 popen2 = os.popen2
76 popen3 = os.popen3
77
78
70
79 def version():
71 def version():
80 """Return version information if available."""
72 """Return version information if available."""
@@ -11,9 +11,13 b' import difflib'
11 import errno
11 import errno
12 import optparse
12 import optparse
13 import os
13 import os
14 try:
15 import subprocess
14 import subprocess
16 subprocess.Popen # trigger ImportError early
15 import shutil
16 import signal
17 import sys
18 import tempfile
19 import time
20
17 closefds = os.name == 'posix'
21 closefds = os.name == 'posix'
18 def Popen4(cmd, bufsize=-1):
22 def Popen4(cmd, bufsize=-1):
19 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
23 p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
@@ -24,14 +28,6 b' try:'
24 p.tochild = p.stdin
28 p.tochild = p.stdin
25 p.childerr = p.stderr
29 p.childerr = p.stderr
26 return p
30 return p
27 except ImportError:
28 subprocess = None
29 from popen2 import Popen4
30 import shutil
31 import signal
32 import sys
33 import tempfile
34 import time
35
31
36 # reserved exit code to skip test (used by hghave)
32 # reserved exit code to skip test (used by hghave)
37 SKIPPED_STATUS = 80
33 SKIPPED_STATUS = 80
General Comments 0
You need to be logged in to leave comments. Login now