summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib/System/system001.hs
blob: 4237d526af678f482817eca4bf7d35192e99d46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Not run on mingw, because of /dev/null use

import System.Cmd (system)
import System.Exit (ExitCode(..), exitWith)

main = 
    system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
    case ec of
        ExitSuccess   -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
        ExitFailure _ ->
            system "cat system001.hs 2>/dev/null" >>= \ ec ->
	    case ec of
	        ExitSuccess   -> exitWith ExitSuccess
	        ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")