diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-01 03:48:45 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-01 03:48:45 -0400 |
| commit | bf4ba055287f46d6e125d8fd7870dd981d224fc8 (patch) | |
| tree | b792c4ac702e4a1fb57b3ebc8cec174e08dee739 /Propellor/SimpleSh.hs | |
| parent | 25c4d185037bcf0c7aa42a11dc0295914c128ddc (diff) | |
docker support is working in theory (but untested)
Diffstat (limited to 'Propellor/SimpleSh.hs')
| -rw-r--r-- | Propellor/SimpleSh.hs | 5 |
1 files changed, 5 insertions, 0 deletions
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 |
