aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/libposix/posix003.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libposix/posix003.hs')
-rw-r--r--tests/libposix/posix003.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/libposix/posix003.hs b/tests/libposix/posix003.hs
new file mode 100644
index 0000000..b28f9f7
--- /dev/null
+++ b/tests/libposix/posix003.hs
@@ -0,0 +1,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
+