diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-10 00:02:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-10 00:02:55 -0400 |
commit | 9f0eba77e889ceeaeb2711ffcd18b1f73ec1b97e (patch) | |
tree | 953b64d8a90a2a4cd787ec4d94b1df0316516f71 /Assistant/XMPP | |
parent | de9f2fa14a82cf1ef7359e8b7ccea4c14c3b8f89 (diff) |
fix exit code propigation
Diffstat (limited to 'Assistant/XMPP')
-rw-r--r-- | Assistant/XMPP/Git.hs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index b2d645fad..fcdb5dc2d 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -163,19 +163,14 @@ relayHandle var = do - we're talking to git-push on stdout - git-receive-pack is talking to us on relayIn (via XMPP) - we're talking to git-receive-pack on relayOut (via XMPP) + - git-receive-pack's exit code will be passed to us on relayControl -} xmppGitRelay :: IO () xmppGitRelay = do flip relay stdout =<< relayHandle relayIn relay stdin =<< relayHandle relayOut - - controlh <- relayHandle relayControl - s <- hGetLine controlh - exitWith $ case readish s of - Just n - | n == 0 -> ExitSuccess - | otherwise -> ExitFailure n - Nothing -> ExitFailure 1 + code <- hGetLine =<< relayHandle relayControl + exitWith $ fromMaybe (ExitFailure 1) $ readish code where {- Is it possible to set up pipes and not need to copy the data - ourselves? See splice(2) -} |