From bf4ba055287f46d6e125d8fd7870dd981d224fc8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Apr 2014 03:48:45 -0400 Subject: docker support is working in theory (but untested) --- Propellor/SimpleSh.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Propellor/SimpleSh.hs') diff --git a/Propellor/SimpleSh.hs b/Propellor/SimpleSh.hs index 971fe502..25a154a9 100644 --- a/Propellor/SimpleSh.hs +++ b/Propellor/SimpleSh.hs @@ -22,6 +22,7 @@ data Resp = StdoutLine String | StderrLine String | Done ExitCode simpleSh :: FilePath -> IO () simpleSh namedpipe = do nukeFile namedpipe + createDirectoryIfMissing True (takeDirectory namedpipe) s <- socket AF_UNIX Stream defaultProtocol bind s (SockAddrUnix namedpipe) listen s 2 @@ -71,3 +72,7 @@ simpleShClient namedpipe cmd params handler = do hPutStrLn h $ show $ Cmd cmd params resps <- catMaybes . map readish . lines <$> hGetContents h hClose h `after` handler resps + +getStdout :: Resp -> Maybe String +getStdout (StdoutLine s) = Just s +getStdout _ = Nothing -- cgit v1.2.3