futhark-server 1.1.1.0 → 1.1.2.0
raw patch · 3 files changed
+18/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- futhark-server.cabal +1/−1
- src/Futhark/Server.hs +12/−5
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for futhark-server +## 1.1.2.0 -- 2021-10-24++* `stopServer` (and hence `withServer`) now throw an exception if the+ process fails.+ ## 1.1.1.0 -- 2021-09-30 * Added `cmdPauseProfiling`, `cmdUnpauseProfiling`, `cmdSetTuningParam`.
futhark-server.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: futhark-server-version: 1.1.1.0+version: 1.1.2.0 synopsis: Client implementation of the Futhark server protocol. description: Provides an easy way to interact with a running Futhark
src/Futhark/Server.hs view
@@ -100,7 +100,8 @@ -- | Start up a server. Make sure that 'stopServer' is eventually -- called on the server. If this does not happen, then temporary -- files may be left on the file system. You almost certainly wish to--- use 'bracket' or similar to avoid this.+-- use 'bracket' or similar to avoid this. Calls 'error' if startup+-- fails. startServer :: ServerCfg -> IO Server startServer (ServerCfg prog options debug) = do tmpdir <- getCanonicalTemporaryDirectory@@ -141,12 +142,18 @@ ++ "\nStderr:\n" ++ stderr_s --- | Shut down a server. It may not be used again.+-- | Shut down a server. It may not be used again. Calls 'error' if+-- the server process terminates with a failing exit code+-- (i.e. anything but 'ExitSuccess'). stopServer :: Server -> IO ()-stopServer s = do+stopServer s = flip finally (removeFile (serverErrLog s)) $ do hClose $ serverStdin s- void $ P.waitForProcess $ serverProc s- removeFile $ serverErrLog s+ code <- P.waitForProcess $ serverProc s+ case code of+ ExitSuccess -> pure ()+ ExitFailure _ -> do+ stderr_s <- readFile $ serverErrLog s+ error stderr_s -- | Start a server, execute an action, then shut down the server. -- The 'Server' may not be returned from the action.