summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2017-07-13 11:10:27 -0400
committerJoey Hess2017-07-13 11:10:27 -0400
commit043cd2218efb8e3d2f04ae2faff38293a01ed0c5 (patch)
tree6a65363f435863139950616cc12ca7ef74042fdf
parent62202b9331f223c7a1dbd8385a2126e45058df83 (diff)
Revert "disable buffering earlier"
This reverts commit 632137836b39462883483a621f9dd696ce1d73cc. Still failing :( Seems that disabling buffering is not the solution.
-rw-r--r--src/Propellor/CmdLine.hs1
-rw-r--r--src/Propellor/Protocol.hs6
-rw-r--r--src/Propellor/Spin.hs13
3 files changed, 8 insertions, 12 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 70bb0bf8..a36ec7f5 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -111,7 +111,6 @@ data CanRebuild = CanRebuild | NoRebuild
defaultMain :: [Host] -> IO ()
defaultMain hostlist = withConcurrentOutput $ do
useFileSystemEncoding
- updatePrepare
Shim.cleanEnv
checkDebugMode
cmdline <- processCmdLine
diff --git a/src/Propellor/Protocol.hs b/src/Propellor/Protocol.hs
index bc8d9327..ae7e0404 100644
--- a/src/Propellor/Protocol.hs
+++ b/src/Propellor/Protocol.hs
@@ -53,7 +53,11 @@ sendMarked' h marker s = do
hFlush h
getMarked :: Handle -> Marker -> IO (Maybe String)
-getMarked h marker = go =<< catchMaybeIO (hGetLine h)
+getMarked h marker = do
+ -- Avoid buffering anything in Handle, so that the data after
+ -- the marker will be available to be read from the underlying Fd.
+ hSetBuffering stdin NoBuffering
+ go =<< catchMaybeIO (hGetLine h)
where
go Nothing = return Nothing
go (Just l) = case fromMarked marker l of
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs
index 732ec9b7..7146ad4c 100644
--- a/src/Propellor/Spin.hs
+++ b/src/Propellor/Spin.hs
@@ -5,7 +5,6 @@ module Propellor.Spin (
spin,
spin',
update,
- updatePrepare,
gitPushHelper,
mergeSpin,
) where
@@ -350,20 +349,14 @@ findLastNonSpinCommit = do
spinCommitMessage :: String
spinCommitMessage = "propellor spin"
--- Avoid buffering anything read from stdin, so that
--- when gitPullFromUpdateServer runs git fetch, it sees all the data
--- it expects to.
---
--- Should be called very early in propellor start, before anything reads
--- from stdin.
-updatePrepare :: IO ()
-updatePrepare = hSetBuffering stdin NoBuffering
-
-- Stdin and stdout are connected to the updateServer over ssh.
-- Request that it run git upload-pack, and connect that up to a git fetch
-- to receive the data.
gitPullFromUpdateServer :: IO ()
gitPullFromUpdateServer = reqMarked NeedGitPush gitPushMarker $ \_ -> do
+ -- Note that this relies on data not being buffered in the stdin
+ -- Handle, since such buffered data would not be available in the
+ -- FD passed to git fetch.
hin <- dup stdInput
hout <- dup stdOutput
hClose stdin