blob: c93a4168b2df7b9ece36d0fa20fec73ca118a2b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import System.Posix.Process
main = do
pid <- getProcessID
ppid <- getParentProcessID
ppgid <- getProcessGroupIDOf ppid
-- join the parent process
putStr "Testing joinProcessGroup: "
joinProcessGroup ppgid
pgid1 <- getProcessGroupID
print $ ppgid == pgid1
-- be a leader
putStr "Testing createProcessGroupFor: "
createProcessGroupFor pid
pgid2 <- getProcessGroupID
print $ pid == fromIntegral pgid2
-- and join the parent again
putStr "Testing setProcessGroupIDOf: "
setProcessGroupIDOf pid ppgid
pgid3 <- getProcessGroupID
print $ ppgid == pgid3
|