finally cracked it!

A newline was slipping in and messing up the git protocol.
This commit is contained in:
Joey Hess 2014-11-18 16:52:01 -04:00
parent 83431b7b58
commit 511a728b38
2 changed files with 2 additions and 9 deletions

View File

@ -216,15 +216,11 @@ spin hn hst = do
loop loop
Just NeedGitPush -> do Just NeedGitPush -> do
sendMarked toh gitPushMarker "" sendMarked toh gitPushMarker ""
void $ hGetLine fromh
let p = (proc "git" ["upload-pack", "."]) let p = (proc "git" ["upload-pack", "."])
{ std_in = UseHandle fromh { std_in = UseHandle fromh
, std_out = UseHandle toh , std_out = UseHandle toh
} }
(Nothing, Nothing, Nothing, h) <- createProcess p (Nothing, Nothing, Nothing, h) <- createProcess p
{-forever $ do
b <- B.hGetSome fromh 40960
hPutStrLn stderr $ show ("<<<", b)-}
unlessM ((==) ExitSuccess <$> waitForProcess h) $ unlessM ((==) ExitSuccess <$> waitForProcess h) $
errorMessage "git upload-pack failed" errorMessage "git upload-pack failed"
-- no more protocol possible after -- no more protocol possible after
@ -330,7 +326,6 @@ gitPush hin hout = void $ fromstdin `concurrently` tostdout
hSetBinaryMode fromh True hSetBinaryMode fromh True
hSetBinaryMode toh True hSetBinaryMode toh True
b <- B.hGetSome fromh 40960 b <- B.hGetSome fromh 40960
hPutStrLn stderr $ show ("from", fromh, "to", toh, b)
if B.null b if B.null b
then do then do
hClose fromh hClose fromh

View File

@ -1,7 +1,7 @@
-- | This is a simple line-based protocol used for communication between -- | This is a simple line-based protocol used for communication between
-- a local and remote propellor. It's sent over a ssh channel, and lines of -- a local and remote propellor. It's sent over a ssh channel, and lines of
-- the protocol can be interspersed with other, non-protocol lines -- the protocol can be interspersed with other, non-protocol lines
-- that should just be passed through to be displayed. -- that should be ignored.
module Propellor.Protocol where module Propellor.Protocol where
@ -48,9 +48,7 @@ getMarked h marker = go =<< catchMaybeIO (hGetLine h)
where where
go Nothing = return Nothing go Nothing = return Nothing
go (Just l) = case fromMarked marker l of go (Just l) = case fromMarked marker l of
Nothing -> do Nothing -> getMarked h marker
putStrLn l
getMarked h marker
Just v -> return (Just v) Just v -> return (Just v)
req :: Stage -> Marker -> (String -> IO ()) -> IO () req :: Stage -> Marker -> (String -> IO ()) -> IO ()