aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/libposix/posix003.hs
blob: b28f9f7dbf3f45ed82b977d9266f974220330494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

import Control.Monad
import Data.Char
import System.Exit
import System.IO
import System.Process

main = do hw <- openFile "po003.out" WriteMode
          ph <- runProcess "pwd" [] (Just "/dev") Nothing Nothing (Just hw) Nothing
          ec <- waitForProcess ph
          hClose hw
          unless (ec == ExitSuccess) $ error "pwd failed"
          hr <- openFile "po003.out" ReadMode
          output <- hGetContents hr
          putStrLn ("Got: " ++ show (filter (not . isSpace) output))
          hClose hr