blob: ed20df793998c3590beee7af30a611c5b3832ce0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
module Main(main) where
import Posix
main :: IO ()
main = do
ppid <- getParentProcessID
pid <- getProcessID
putStr "Parent Process ID: "
print ppid
putStr "Process ID: "
print pid
putStr "forking ps ux"
print ppid
child <- forkProcess
case child of
Nothing -> executeFile "ps" True ["ux" ++ show ppid] Nothing
Just x -> doParent x pid
doParent cpid pid = do
getProcessStatus True False cpid
putStr "\nChild finished. Now exec'ing ps ux\n"
print pid
executeFile "ps" True ["ux" ++ show pid] Nothing
|