diff options
author | Ian Lynagh <igloo@earth.li> | 2011-10-18 21:50:12 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-18 21:50:12 +0100 |
commit | 766e2117d483efa434907a09fcce2796f113961f (patch) | |
tree | 8ad3eab720fd25cee0a33246d57103ad6984e08d /testsuite/timeout | |
parent | c0ac40a7d574d7cca751653e8ba02a26db1309c5 (diff) | |
download | haskell-766e2117d483efa434907a09fcce2796f113961f.tar.gz |
Fix passing spaces to tests on Windows, and add a test for it
Diffstat (limited to 'testsuite/timeout')
-rw-r--r-- | testsuite/timeout/timeout.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/testsuite/timeout/timeout.hs b/testsuite/timeout/timeout.hs index ca2eaf7a41..3a709b9f2c 100644 --- a/testsuite/timeout/timeout.hs +++ b/testsuite/timeout/timeout.hs @@ -104,12 +104,16 @@ ignoreIOExceptions io = io `catch` ((\_ -> return ()) :: IOException -> IO ()) #else run secs cmd = + let escape '\\' = "\\\\" + escape '"' = "\\\"" + escape c = [c] + cmd' = "sh -c \"" ++ concatMap escape cmd ++ "\"" in alloca $ \p_startupinfo -> alloca $ \p_pi -> - withTString ("sh -c \"" ++ cmd ++ "\"") $ \cmd' -> + withTString cmd' $ \cmd'' -> do job <- createJobObjectW nullPtr nullPtr let creationflags = 0 - b <- createProcessW nullPtr cmd' nullPtr nullPtr True + b <- createProcessW nullPtr cmd'' nullPtr nullPtr True creationflags nullPtr nullPtr p_startupinfo p_pi unless b $ errorWin "createProcessW" |