summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2014-11-18 16:10:13 -0400
committerJoey Hess2014-11-18 16:10:13 -0400
commitc1a6f81c7ef7095273c6665521ac156c82e6b687 (patch)
treedd6cf50fc8c4993c8c86e0081d4360c9f91093d0 /src
parent47a7d583368e6b67d8b2eb025a4d71ac6a9433e7 (diff)
better IO loop, with debugging
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/CmdLine.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index ea2fadad..f8d5d57d 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -12,7 +12,7 @@ import Control.Exception (bracket)
import System.Posix.IO
import Data.Time.Clock.POSIX
import Control.Concurrent.Async
-import qualified Data.ByteString.Lazy as B
+import qualified Data.ByteString as B
import System.Process (std_in, std_out)
import Propellor
@@ -317,10 +317,17 @@ gitPush hin hout = void $ fromstdin `concurrently` tostdout
where
fromstdin = do
h <- fdToHandle hout
- B.getContents >>= B.hPut h
+ connect stdin h
tostdout = do
h <- fdToHandle hin
- B.hGetContents h >>= B.putStr
+ connect h stdout
+ connect fromh toh = do
+ b <- B.hGetSome fromh 40960
+ unless (B.null b) $ do
+ hPutStrLn stderr $ show ("got", fromh, b)
+ B.hPut toh b
+ hFlush toh
+ connect fromh toh
hasOrigin :: IO Bool
hasOrigin = do