Commit 6ce959d6 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Respond gracefull to shutdown

parent 60df949a
......@@ -14,10 +14,10 @@ import IHaskell.Types
-- ghc (api) version number like ints [7,6,2]. Could be done at compile
-- time, but for now there's no template haskell in IHaskell
ghcVersionInts = ints $
map read $ words $
map (\x -> case x of '.' -> ' '; _ -> x)
(VERSION_ghc :: String)
ghcVersionInts :: [Int]
ghcVersionInts = ints . map read . words . map dotToSpace $ (VERSION_ghc :: String)
where dotToSpace '.' = ' '
dotToSpace x = x
-- Convert message bodies into JSON.
instance ToJSON Message where
......@@ -71,6 +71,11 @@ instance ToJSON Message where
"docstring" .= objectDocString o
]
toJSON ShutdownReply{restartPending = restart} = object [
"restart" .= restart
]
toJSON body = error $ "Do not know how to convert to JSON for message " ++ show body
......
......@@ -291,4 +291,5 @@ replyType KernelInfoRequestMessage = KernelInfoReplyMessage
replyType ExecuteRequestMessage = ExecuteReplyMessage
replyType CompleteRequestMessage = CompleteReplyMessage
replyType ObjectInfoRequestMessage = ObjectInfoReplyMessage
replyType ShutdownRequestMessage = ShutdownReplyMessage
replyType messageType = error $ "No reply for message type " ++ show messageType
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment