Add stage2/ghci to ghc-api's import list.
[ghc-hetmet.git] / ghc / misc / examples / posix / po001 / Main.hs
1 import Posix
2
3 main =
4     getParentProcessID >>= \ ppid ->
5     getProcessID >>= \ pid ->
6     putStr "Parent Process ID: " >>
7     print ppid >>
8     putStr "\nProcess ID: " >>
9     print pid >>
10     putStr "\nforking ps uxww" >>
11     print ppid >>
12     putChar '\n' >>
13     forkProcess >>= \ child ->
14     case child of
15         Nothing -> executeFile "ps" True ["uxww" ++ show ppid] Nothing
16         Just x -> doParent x pid
17
18 doParent cpid pid =
19     getProcessStatus True False cpid >>
20     putStr "\nChild finished.  Now exec'ing ps uxww" >>
21     print pid >>
22     putChar '\n' >>
23     executeFile "ps" True ["uxww" ++ show pid] Nothing