[project @ 2001-08-22 11:45:06 by sewardj]
[ghc-hetmet.git] / ghc / tests / lib / posix / posix001.hs
1 module Main(main) where
2
3 import Posix
4
5 main :: IO ()
6 main = do
7     ppid <- getParentProcessID
8     pid  <- getProcessID
9     putStr "Parent Process ID: "
10     print ppid
11     putStr "Process ID: "
12     print pid
13     putStr "forking ps ux"
14     print ppid
15     child <- forkProcess
16     case child of
17         Nothing -> executeFile "ps" True ["ux" ++ show ppid] Nothing
18         Just x -> doParent x pid
19
20 doParent cpid pid = do
21     getProcessStatus True False cpid
22     putStr "\nChild finished.  Now exec'ing ps ux\n"
23     print pid
24     executeFile "ps" True ["ux" ++ show pid] Nothing