Bug 544128: windows compatibility for shell JSTest harness, r=dvander

This commit is contained in:
David Mandelin 2010-02-04 14:41:50 -08:00
parent 61112f8395
commit 7696840b5d
2 changed files with 5 additions and 3 deletions

View File

@ -70,9 +70,9 @@ class XULInfoTester:
cmd = [ self.js_bin, '-e', self.js_prolog, '-e', 'print(!!(%s))'%cond ]
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
if out == 'true\n':
if out in ('true\n', 'true\r\n'):
ans = True
elif out == 'false\n':
elif out in ('false\n', 'false\r\n'):
ans = False
else:
raise Exception("Failed to test XUL condition '%s'"%cond)

View File

@ -14,7 +14,9 @@ def do_run_cmd(cmd):
def th_run_cmd(cmd, l):
t0 = datetime.datetime.now()
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
# close_fds is not supported on Windows and will cause a ValueError.
close_fds = sys.platform != 'win32'
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=close_fds)
l[0] = p
out, err = p.communicate()
t1 = datetime.datetime.now()