propellor spin
This commit is contained in:
parent
93d772a60a
commit
45a453a87e
|
@ -166,9 +166,7 @@ spin host = do
|
||||||
showremote s = putStrLn s
|
showremote s = putStrLn s
|
||||||
senddata toh f marker s = void $
|
senddata toh f marker s = void $
|
||||||
actionMessage ("Sending " ++ f ++ " (" ++ show (length s) ++ " bytes) to " ++ host) $ do
|
actionMessage ("Sending " ++ f ++ " (" ++ show (length s) ++ " bytes) to " ++ host) $ do
|
||||||
hFlush stdout
|
sendMarked toh marker s
|
||||||
hPutStrLn toh $ toMarked marker s
|
|
||||||
hFlush toh
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
sendGitClone :: HostName -> String -> IO ()
|
sendGitClone :: HostName -> String -> IO ()
|
||||||
|
@ -206,6 +204,13 @@ privDataMarker = "PRIVDATA "
|
||||||
toMarked :: Marker -> String -> String
|
toMarked :: Marker -> String -> String
|
||||||
toMarked marker = intercalate "\n" . map (marker ++) . lines
|
toMarked marker = intercalate "\n" . map (marker ++) . lines
|
||||||
|
|
||||||
|
sendMarked :: Handle -> Marker -> String -> IO ()
|
||||||
|
sendMarked h marker s = do
|
||||||
|
-- Prefix string with newline because sometimes a
|
||||||
|
-- incomplete line is output.
|
||||||
|
hPutStrLn h ("\n" ++ toMarked marker s)
|
||||||
|
hFlush h
|
||||||
|
|
||||||
fromMarked :: Marker -> Marked -> Maybe String
|
fromMarked :: Marker -> Marked -> Maybe String
|
||||||
fromMarked marker s
|
fromMarked marker s
|
||||||
| null matches = Nothing
|
| null matches = Nothing
|
||||||
|
@ -217,8 +222,7 @@ fromMarked marker s
|
||||||
|
|
||||||
boot :: [Property] -> IO ()
|
boot :: [Property] -> IO ()
|
||||||
boot props = do
|
boot props = do
|
||||||
putStrLn $ toMarked statusMarker $ show Ready
|
sendMarked stdout statusMarker $ show Ready
|
||||||
hFlush stdout
|
|
||||||
reply <- hGetContentsStrict stdin
|
reply <- hGetContentsStrict stdin
|
||||||
|
|
||||||
makePrivDataDir
|
makePrivDataDir
|
||||||
|
|
Loading…
Reference in New Issue