@@ -0,0 +1,35 @@
8+WIFEXITED : (status : Int) -> IO Bool
10+ r <- foreign FFI_C "WIFEXITED_" (Int -> IO Int) status
13+WEXITSTATUS : (status : Int) -> IO Int
14+WEXITSTATUS status = foreign FFI_C "WEXITSTATUS_" (Int -> IO Int) status
16+execute : (cmd : String) -> (expectedStatus : Int) -> IO ()
17+execute cmd expectedStatus = do
18+ putStrLn "-------------------------------------------"
19+ putStrLn $ "Executing '" ++ cmd ++ "'"
20+ status1 <- system cmd
21+ putStrLn $ "raw status = " ++ show status1 -- XXX: Probably not portable.
22+ exited <- WIFEXITED status1
25+ exitStatus <- WEXITSTATUS status1
26+ putStrLn $ "exit status = " ++ show exitStatus
27+ printLn $ exitStatus == expectedStatus
35+ execute "./does-not-exist" 127