add processGroup001/processGroup002
[packages/unix.git] / tests / processGroup002.hs
1 import System.Posix.Process
2
3 main = do
4 pid <- getProcessID
5 ppid <- getParentProcessID
6 ppgid <- getProcessGroupIDOf ppid
7 -- join the parent process
8 putStr "Testing joinProcessGroup: "
9 joinProcessGroup ppgid
10 pgid1 <- getProcessGroupID
11 print $ ppgid == pgid1
12 -- be a leader
13 putStr "Testing createProcessGroupFor: "
14 createProcessGroupFor pid
15 pgid2 <- getProcessGroupID
16 print $ pid == fromIntegral pgid2
17 -- and join the parent again
18 putStr "Testing setProcessGroupIDOf: "
19 setProcessGroupIDOf pid ppgid
20 pgid3 <- getProcessGroupID
21 print $ ppgid == pgid3