diff options
| author | Joey Hess <joey@kitenet.net> | 2014-05-11 10:22:59 -0300 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-05-11 10:22:59 -0300 |
| commit | f92800ad0f5b2d94868fee2539e433ea3a6f4f46 (patch) | |
| tree | 4db8c724dc0dc1e02e1da7994d26a2589784417d /Propellor/SimpleSh.hs | |
| parent | 43a23578ebd92e880e582b397a0507ce5e0d7d66 (diff) | |
propellor spin
Diffstat (limited to 'Propellor/SimpleSh.hs')
| -rw-r--r-- | Propellor/SimpleSh.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs index d99268d1..f1a84951 100644 --- a/Propellor/SimpleSh.hs +++ b/Propellor/SimpleSh.hs @@ -35,9 +35,11 @@ simpleSh namedpipe = do maybe noop (run h) . readish =<< hGetLine h where run h (Cmd cmd params) = do + debug ["simplesh run", cmd, show params] chan <- newChan let runwriter = do v <- readChan chan + debug ["simplesh run", cmd, show params, "writer got:", show v] hPutStrLn h (show v) hFlush h case v of @@ -52,6 +54,7 @@ simpleSh namedpipe = do , std_err = CreatePipe } (Nothing, Just outh, Just errh, pid) <- createProcess p + debug ["simplesh run", cmd, show params, "started"] let mkreader t from = maybe noop (const $ mkreader t from) =<< catchMaybeIO (writeChan chan . t =<< hGetLine from) @@ -59,15 +62,19 @@ simpleSh namedpipe = do (mkreader StdoutLine outh) (mkreader StderrLine errh) + debug ["simplesh run", cmd, show params, "waiting for process"] void $ tryIO $ waitForProcess pid + debug ["simplesh run", cmd, show params, "sending Done"] writeChan chan Done hClose outh hClose errh + debug ["simplesh run", cmd, show params, "wait writer"] wait writer hClose h + debug ["simplesh run", cmd, show params, "fully done"] simpleShClient :: FilePath -> String -> [String] -> ([Resp] -> IO a) -> IO a simpleShClient namedpipe cmd params handler = do |
