Skip to content

Commit 35b0a47

Browse files
authored
Merge pull request #164 from istathar/ensure-threaded
Ensure threaded runtime present
2 parents a338072 + 2b621b6 commit 35b0a47

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

core-program/core-program.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.12
55
-- see: https://github.com/sol/hpack
66

77
name: core-program
8-
version: 0.6.2.1
8+
version: 0.6.2.2
99
synopsis: Opinionated Haskell Interoperability
1010
description: A library to help build command-line programs, both tools and
1111
longer-running daemons.

core-program/lib/Core/Program/Execute.hs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ import Control.Exception.Safe qualified as Safe
140140
import Control.Monad
141141
( forM_
142142
, forever
143+
, unless
143144
, void
144145
, when
145146
)
@@ -172,6 +173,8 @@ import System.Directory
172173
( findExecutable
173174
)
174175
import System.Exit (ExitCode (..))
176+
import System.Posix.Internals (hostIsThreaded)
177+
import System.Posix.Process qualified as Posix (exitImmediately)
175178
import System.Process.Typed (nullStream, proc, readProcess, setStdin)
176179
import Prelude hiding (log)
177180

@@ -230,8 +233,14 @@ executeWith = executeActual
230233

231234
executeActual :: Context τ -> Program τ α -> IO ()
232235
executeActual context0 program = do
236+
-- ensure threaded runtime is active
237+
unless hostIsThreaded $ do
238+
putStrLn "error: Application must be compiled with -threaded GHC option"
239+
Posix.exitImmediately (ExitFailure 98)
240+
233241
-- command line +RTS -Nn -RTS value
234-
when (numCapabilities == 1) (getNumProcessors >>= setNumCapabilities)
242+
when (numCapabilities == 1) $ do
243+
getNumProcessors >>= setNumCapabilities
235244

236245
-- force UTF-8 working around bad VMs
237246
setLocaleEncoding utf8

core-program/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: core-program
2-
version: 0.6.2.1
2+
version: 0.6.2.2
33
synopsis: Opinionated Haskell Interoperability
44
description: |
55
A library to help build command-line programs, both tools and

core-telemetry/core-telemetry.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
cabal-version: 1.18
22

3-
-- This file has been generated from package.yaml by hpack version 0.35.0.
3+
-- This file has been generated from package.yaml by hpack version 0.35.1.
44
--
55
-- see: https://github.com/sol/hpack
66

77
name: core-telemetry
8-
version: 0.2.7.0
8+
version: 0.2.7.2
99
synopsis: Advanced telemetry
1010
description: This is part of a library to help build command-line programs, both tools and
1111
longer-running daemons.
@@ -54,7 +54,7 @@ library
5454
base >=4.11 && <5
5555
, bytestring
5656
, core-data >=0.3.8.0
57-
, core-program >=0.6.1
57+
, core-program >=0.6.2.2
5858
, core-text >=0.3.7.1
5959
, exceptions
6060
, http-streams

core-telemetry/package.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: core-telemetry
2-
version: 0.2.7.0
2+
version: 0.2.7.2
33
synopsis: Advanced telemetry
44
description: |
55
This is part of a library to help build command-line programs, both tools and
@@ -34,7 +34,7 @@ library:
3434
dependencies:
3535
- core-text >= 0.3.7.1
3636
- core-data >= 0.3.8.0
37-
- core-program >= 0.6.1
37+
- core-program >= 0.6.2.2
3838
- exceptions
3939
- http-streams
4040
- io-streams

0 commit comments

Comments
 (0)