summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/codeGen/should_run/cgrun025.hs
blob: 8df89450883484fb4ac9133407246d8c3a8ffeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- !!! test various I/O Requests
--
--
import IO
import System
import Debug.Trace (trace)
import Text.Regex
import Maybe

main = do
    prog <- getProgName
    let Just (name:_) = matchRegex (mkRegex ".*(cg025)") prog
    hPutStr stderr (shows name "\n")
    args <- getArgs
    hPutStr stderr (shows args "\n")
    path <- getEnv "PATH"
    hPutStr stderr ("GOT PATH\n")
    stdin_txt <- getContents
    putStr stdin_txt
    file_cts <- readFile (head args)
    hPutStr  stderr file_cts
    trace "hello, trace" $
      catch (getEnv "__WURBLE__" >> return ()) (\ e -> error "hello, error")