diff options
author | Gintautas Miliauskas <gintautas.miliauskas@gmail.com> | 2014-09-22 23:10:56 +0200 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-11-19 17:03:05 -0600 |
commit | 101c62e26286353dd3fac1ef54323529b64c9902 (patch) | |
tree | fffdc0abfec3d771455d8e59337ffd09d5938be3 /testsuite/driver | |
parent | 8e0a480ca655010e67a38aca9b8705ecbd0f0c97 (diff) | |
download | haskell-101c62e26286353dd3fac1ef54323529b64c9902.tar.gz |
The test runner now also works under the msys-native Python.
Msys binaries apply heuristics to escape paths in arguments intended for
non-msys binaries, which breaks timeout invocations, see #9626.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'testsuite/driver')
-rw-r--r-- | testsuite/driver/testlib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 1549381ee6..6fc86e4c5a 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1780,9 +1780,25 @@ def rawSystem(cmd_and_args): else: return os.spawnv(os.P_WAIT, cmd_and_args[0], cmd_and_args) +# When running under native msys Python, any invocations of non-msys binaries, +# including timeout.exe, will have their arguments munged according to some +# heuristics, which leads to malformed command lines (#9626). The easiest way +# to avoid problems is to invoke through /usr/bin/cmd which sidesteps argument +# munging because it is a native msys application. +def passThroughCmd(cmd_and_args): + args = [] + # cmd needs a Windows-style path for its first argument. + args.append(cmd_and_args[0].replace('/', '\\')) + # Other arguments need to be quoted to deal with spaces. + args.extend(['"%s"' % arg for arg in cmd_and_args[1:]]) + return ["cmd", "/c", " ".join(args)] + # Note that this doesn't handle the timeout itself; it is just used for # commands that have timeout handling built-in. def rawSystemWithTimeout(cmd_and_args): + if config.os == 'mingw32' and sys.executable.startswith('/usr'): + # This is only needed when running under msys python. + cmd_and_args = passThroughCmd(cmd_and_args) r = rawSystem(cmd_and_args) if r == 98: # The python timeout program uses 98 to signal that ^C was pressed |