summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2014-11-18 16:36:34 -0400
committerJoey Hess2014-11-18 16:36:43 -0400
commitc008813becfa09162d249adbb4ae47f16e329d23 (patch)
treec35bda92e8af004399185300ada60258515e0b38 /src
parentefa5b12516510b53d873fd44be9d2d1f13391672 (diff)
close handles
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/CmdLine.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 293bf3a2..8591395d 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -325,10 +325,14 @@ gitPush hin hout = void $ fromstdin `concurrently` tostdout
connect fromh toh = do
b <- B.hGetSome fromh 40960
hPutStrLn stderr $ show ("from", fromh, "to", toh, b)
- unless (B.null b) $ do
- B.hPut toh b
- hFlush toh
- connect fromh toh
+ if B.null b
+ then do
+ hClose fromh
+ hClose toh
+ else do
+ B.hPut toh b
+ hFlush toh
+ connect fromh toh
hasOrigin :: IO Bool
hasOrigin = do