2021-06-30 02:12:10 +03:00
|
|
|
import System
|
2021-10-29 18:38:32 +03:00
|
|
|
import System.Info
|
2021-06-30 02:12:10 +03:00
|
|
|
|
|
|
|
main : IO ()
|
|
|
|
main = do
|
|
|
|
0 <- system "bash zero.sh"
|
|
|
|
| r => do putStrLn ("expecting zero, got " ++ (show r))
|
|
|
|
exitFailure
|
|
|
|
-- `system` returns result of `waitpid` which is not trivial to decode
|
2021-10-29 18:38:32 +03:00
|
|
|
let True = !(System.system "bash seventeen.sh") /= 0
|
2021-06-30 02:12:10 +03:00
|
|
|
| False => putStrLn "expecting 17, got zero"
|
2021-10-29 18:38:32 +03:00
|
|
|
|
|
|
|
let nastyStr = "Hello \"world\" $PATH %PATH% \\\" `echo 'Uh, oh'`"
|
|
|
|
ignore $ system $ "echo " ++ escapeArg nastyStr
|
|
|
|
ignore $ system ["echo", nastyStr]
|
|
|
|
|
|
|
|
if not isWindows
|
|
|
|
then do ignore $ system $ "echo " ++ escapeArg "Hello\nworld"
|
|
|
|
ignore $ system ["echo", "Hello\nworld"]
|
|
|
|
else do putStrLn "Hello\nworld\nHello\nworld" -- Windows has no way of escaping '\n', so skip test
|