comparison tests/run-tests.py @ 14340:defa319d8bb7

run-tests: replace chdir() with Popen cwd option
author Patrick Mezard <pmezard@gmail.com>
date Mon, 16 May 2011 21:56:26 +0200
parents ed0bf8e1cd28
children ad5c68a0db6a
comparison
equal deleted inserted replaced
14339:ed0bf8e1cd28 14340:defa319d8bb7
58 processlock = threading.Lock() 58 processlock = threading.Lock()
59 59
60 closefds = os.name == 'posix' 60 closefds = os.name == 'posix'
61 def Popen4(cmd, wd, timeout): 61 def Popen4(cmd, wd, timeout):
62 processlock.acquire() 62 processlock.acquire()
63 orig = os.getcwd() 63 p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=wd,
64 os.chdir(wd)
65 p = subprocess.Popen(cmd, shell=True, bufsize=-1,
66 close_fds=closefds, 64 close_fds=closefds,
67 stdin=subprocess.PIPE, stdout=subprocess.PIPE, 65 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
68 stderr=subprocess.STDOUT) 66 stderr=subprocess.STDOUT)
69 os.chdir(orig)
70 processlock.release() 67 processlock.release()
71 68
72 p.fromchild = p.stdout 69 p.fromchild = p.stdout
73 p.tochild = p.stdin 70 p.tochild = p.stdin
74 p.childerr = p.stderr 71 p.childerr = p.stderr