diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-04 18:21:54 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-04 18:21:54 -0400 |
| commit | 17d46c67fa020b79ce6d31557136a66f66d673af (patch) | |
| tree | a0dbd25b64edf06627cef135b3b4bdcc15ab04c3 /Propellor/SimpleSh.hs | |
| parent | 160b598756ad08c0d4e8d7da038a63d988e0ab7a (diff) | |
docker: When running as effective init inside container, wait on zombies.
Diffstat (limited to 'Propellor/SimpleSh.hs')
| -rw-r--r-- | Propellor/SimpleSh.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs index 0999be9a..99a6fc24 100644 --- a/Propellor/SimpleSh.hs +++ b/Propellor/SimpleSh.hs @@ -9,7 +9,6 @@ import Network.Socket import Control.Concurrent.Chan import Control.Concurrent.Async import System.Process (std_in, std_out, std_err) -import System.Exit import Propellor import Utility.FileMode @@ -18,7 +17,7 @@ import Utility.ThreadScheduler data Cmd = Cmd String [String] deriving (Read, Show) -data Resp = StdoutLine String | StderrLine String | Done ExitCode +data Resp = StdoutLine String | StderrLine String | Done deriving (Read, Show) simpleSh :: FilePath -> IO () @@ -49,7 +48,7 @@ simpleSh namedpipe = do v <- readChan chan hPutStrLn h (show v) case v of - Done _ -> noop + Done -> noop _ -> runwriter writer <- async runwriter @@ -58,8 +57,10 @@ simpleSh namedpipe = do void $ concurrently (mkreader StdoutLine outh) (mkreader StderrLine errh) + + void $ tryIO $ waitForProcess pid - writeChan chan . Done =<< waitForProcess pid + writeChan chan Done wait writer |
