packages feed

futhark-server 1.1.2.0 → 1.1.2.1

raw patch · 3 files changed

+20/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for futhark-server +## 1.1.2.1 -- 2022-02-03++* `withServer` no longer hides a previous exception if an exception+  occurs during `stopServer`.+ ## 1.1.2.0 -- 2021-10-24  * `stopServer` (and hence `withServer`) now throw an exception if the
futhark-server.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               futhark-server-version:            1.1.2.0+version:            1.1.2.1 synopsis: Client implementation of the Futhark server protocol.  description: Provides an easy way to interact with a running Futhark
src/Futhark/Server.hs view
@@ -158,7 +158,19 @@ -- | Start a server, execute an action, then shut down the server. -- The 'Server' may not be returned from the action. withServer :: ServerCfg -> (Server -> IO a) -> IO a-withServer cfg = bracket (startServer cfg) stopServer+withServer cfg m = mask $ \restore -> do+  server <- startServer cfg+  x <- restore (m server) `catch` mException server+  stopServer server+  pure x+  where+    mException server e = do+      -- Anything that goes wrong here is probably less interesting+      -- than the original exception.+      stopServer server `catch` stopServerException e+      throw e+    stopServerException :: SomeException -> SomeException -> IO a+    stopServerException e _ = throw e  -- Read lines of response until the next %%% OK (which is what -- indicates that the server is ready for new instructions).@@ -172,7 +184,7 @@     _ -> (l :) <$> responseLines s  -- | The command failed, and this is why.  The first 'Text' is any--- output before the failure indincator, and the second Text is the+-- output before the failure indicator, and the second Text is the -- output after the indicator. data CmdFailure = CmdFailure {failureLog :: [Text], failureMsg :: [Text]}   deriving (Eq, Ord, Show)