diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-13 11:04:14 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-13 11:04:14 -0400 |
| commit | 632137836b39462883483a621f9dd696ce1d73cc (patch) | |
| tree | a3b875afa1d8609c5b4dcaad0dff459c7174d9f3 /src/Propellor/Spin.hs | |
| parent | 3aae9ad46742d3de514380647811ae495cb83a83 (diff) | |
disable buffering earlier
The "fatal: Couldn't find remote ref HEAD" persists, and is intermittent
so hard to be sure but it seemed that disabling buffering earlier
avoided it. Now done first thing on start.
I was not able to find anything that reads from stdin other than
getMarked, but perhaps there is something..
Diffstat (limited to 'src/Propellor/Spin.hs')
| -rw-r--r-- | src/Propellor/Spin.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index 7146ad4c..732ec9b7 100644 --- a/src/Propellor/Spin.hs +++ b/src/Propellor/Spin.hs @@ -5,6 +5,7 @@ module Propellor.Spin ( spin, spin', update, + updatePrepare, gitPushHelper, mergeSpin, ) where @@ -349,14 +350,20 @@ 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 |
