summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/libposix/posix001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/libposix/posix001.hs')
-rw-r--r--testsuite/tests/lib/libposix/posix001.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/lib/libposix/posix001.hs b/testsuite/tests/lib/libposix/posix001.hs
new file mode 100644
index 0000000000..ed20df7939
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix001.hs
@@ -0,0 +1,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