summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-11-19 16:30:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-11-19 22:39:36 -0400
commit885bcb7fe1f6ec9c7aa395ba99a379aee9d2567a (patch)
tree4a1b70f07f42c487a477af6ad5d42a841a49cdab /Utility
parent378e2e8979addd08557327f14a69386cf9e37c22 (diff)
extend p2p protocol to support gitremote-helpers connect
A bit tricky since Proto doesn't support threads. Rather than adding threading support to it, ended up using a callback that waits for both data on a Handle, and incoming messages at the same time. This commit was sponsored by Denis Dzyubenko on Patreon.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/SimpleProtocol.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Utility/SimpleProtocol.hs b/Utility/SimpleProtocol.hs
index 728b135e8..473129218 100644
--- a/Utility/SimpleProtocol.hs
+++ b/Utility/SimpleProtocol.hs
@@ -24,6 +24,7 @@ module Utility.SimpleProtocol (
import Data.Char
import GHC.IO.Handle
+import System.Exit (ExitCode(..))
import Common
@@ -95,3 +96,9 @@ dupIoHandles = do
instance Serializable [Char] where
serialize = id
deserialize = Just
+
+instance Serializable ExitCode where
+ serialize ExitSuccess = "0"
+ serialize (ExitFailure n) = show n
+ deserialize "0" = Just ExitSuccess
+ deserialize s = ExitFailure <$> readish s