Ticket #1905: Fork.hs
| File Fork.hs, 395 bytes (added by wferi, 6 years ago) |
|---|
| Line | |
|---|---|
| 1 | module Main where |
| 2 | |
| 3 | import Control.Exception (handle) |
| 4 | import System.IO |
| 5 | import System.Process |
| 6 | |
| 7 | sleeper = do |
| 8 | sleep <- runProcess "sleep" ["5"] (Just "nonexistent") |
| 9 | Nothing Nothing Nothing Nothing |
| 10 | waitForProcess sleep |
| 11 | return () |
| 12 | |
| 13 | main = do |
| 14 | handle (hPrint stderr) sleeper |
| 15 | ps <- runProcess "ps" ["xf"] Nothing |
| 16 | Nothing Nothing Nothing Nothing |
| 17 | waitForProcess ps |
