summaryrefslogtreecommitdiff
path: root/Propellor/SimpleSh.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-04 18:21:54 -0400
committerJoey Hess2014-04-04 18:21:54 -0400
commit17d46c67fa020b79ce6d31557136a66f66d673af (patch)
treea0dbd25b64edf06627cef135b3b4bdcc15ab04c3 /Propellor/SimpleSh.hs
parent160b598756ad08c0d4e8d7da038a63d988e0ab7a (diff)
docker: When running as effective init inside container, wait on zombies.
Diffstat (limited to 'Propellor/SimpleSh.hs')
-rw-r--r--Propellor/SimpleSh.hs9
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