summaryrefslogtreecommitdiff
path: root/Propellor/SimpleSh.hs
diff options
context:
space:
mode:
authorJoey Hess2014-05-14 19:34:26 -0400
committerJoey Hess2014-05-14 19:34:26 -0400
commit5a5adab86788d93103803df27a1004d0d9696b1d (patch)
tree4ebf8c49ff97fbd2b35d06eaced0b4794a17cc31 /Propellor/SimpleSh.hs
parentffce1f80ae3c492fe768666a00df396448ad6368 (diff)
remove simplsh debug code
Seems I have really fixed that bug!
Diffstat (limited to 'Propellor/SimpleSh.hs')
-rw-r--r--Propellor/SimpleSh.hs11
1 files changed, 0 insertions, 11 deletions
diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs
index 69ded47b..7ba30b0e 100644
--- a/Propellor/SimpleSh.hs
+++ b/Propellor/SimpleSh.hs
@@ -36,11 +36,9 @@ 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
@@ -55,7 +53,6 @@ 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)
@@ -63,33 +60,25 @@ 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
- debug ["simplesh run", cmd, show params, "wait writer complete"]
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
- debug ["simplesh connecting"]
s <- socket AF_UNIX Stream defaultProtocol
connect s (SockAddrUnix namedpipe)
h <- socketToHandle s ReadWriteMode
hPutStrLn h $ show $ Cmd cmd params
hFlush h
- debug ["simplesh sent command"]
resps <- catMaybes . map readish . lines <$> hGetContents h
v <- hClose h `after` handler resps
- debug ["simplesh processed response"]
return v
simpleShClientRetry :: Int -> FilePath -> String -> [String] -> ([Resp] -> IO a) -> IO a