summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-23 13:32:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-23 13:38:52 -0400
commitaec4709c3f96fa17fef2fde812ed75167ddfbc60 (patch)
tree2dda212d476a468841c44885ce92a28d8b845b7f
parent89fd7b34ce815fc5816de5c71f07382e30f50bd5 (diff)
fix gotcha with closed stderr and --debug
-rw-r--r--Branch.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Branch.hs b/Branch.hs
index 6b2e8c23e..cb2feea6a 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -25,6 +25,7 @@ import Data.List
import System.IO
import System.Posix.IO
import System.Posix.Process
+import System.Log.Logger
import Types.BranchState
import qualified GitRepo as Git
@@ -227,8 +228,16 @@ cmdOutput cmd params = do
x <- hGetContentsStrict h
hClose h
return $! x
- pid <- pOpen3Raw Nothing (Just (snd pipepair)) Nothing cmd params
- (closeFd (fst pipepair) >> closeFd stdError)
+ let child = do
+ closeFd (fst pipepair)
+ -- disable stderr output by this child,
+ -- and since the logger uses it, also disable it
+ liftIO $ updateGlobalLogger rootLoggerName $ setLevel EMERGENCY
+ closeFd stdError
+
+ debugM "Utility.executeFile" $ cmd ++ " " ++ show params
+
+ pid <- pOpen3Raw Nothing (Just (snd pipepair)) Nothing cmd params child
retval <- callfunc $! pid
let rv = seq retval retval
_ <- getProcessStatus True False pid