Show More
@@ -11,7 +11,22 b' import difflib' | |||||
11 | import errno |
|
11 | import errno | |
12 | import optparse |
|
12 | import optparse | |
13 | import os |
|
13 | import os | |
14 | import popen2 |
|
14 | try: | |
|
15 | import subprocess | |||
|
16 | subprocess.Popen # trigger ImportError early | |||
|
17 | closefds = os.name == 'posix' | |||
|
18 | def Popen4(cmd, bufsize=-1): | |||
|
19 | p = subprocess.Popen(cmd, shell=True, bufsize=bufsize, | |||
|
20 | close_fds=closefds, | |||
|
21 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, | |||
|
22 | stderr=subprocess.STDOUT) | |||
|
23 | p.fromchild = p.stdout | |||
|
24 | p.tochild = p.stdin | |||
|
25 | p.childerr = p.stderr | |||
|
26 | return p | |||
|
27 | except ImportError: | |||
|
28 | subprocess = None | |||
|
29 | from popen2 import Popen4 | |||
15 | import shutil |
|
30 | import shutil | |
16 | import signal |
|
31 | import signal | |
17 | import sys |
|
32 | import sys | |
@@ -281,7 +296,7 b' def run(cmd):' | |||||
281 | if ret == None: |
|
296 | if ret == None: | |
282 | ret = 0 |
|
297 | ret = 0 | |
283 | else: |
|
298 | else: | |
284 |
proc = |
|
299 | proc = Popen4(cmd) | |
285 | try: |
|
300 | try: | |
286 | output = '' |
|
301 | output = '' | |
287 | proc.tochild.close() |
|
302 | proc.tochild.close() |
General Comments 0
You need to be logged in to leave comments.
Login now