Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit cd154b0

Browse files
Hiroto Shioiksaric
Hiroto Shioi
authored andcommitted
Disable terminal GUI on Windows (#330)
1 parent 8abae42 commit cd154b0

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

cardano-launcher/app/Main.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ module Main where
66
import Cardano.Prelude
77
import qualified Prelude
88

9+
import Distribution.System (OS (Windows), buildOS)
910
import System.Environment (setEnv)
1011
import System.Exit (exitWith)
12+
import System.IO.Silently (hSilence)
1113

1214
import Formatting (bprint, build, formatToString)
1315
import Formatting.Buildable (Buildable (..))
@@ -39,7 +41,7 @@ import Data.Text.Lazy.Builder (fromString, fromText)
3941

4042
-- | Main function.
4143
main :: IO ()
42-
main = do
44+
main = silence $ do
4345

4446
logConfig <- defaultConfigStdout
4547

@@ -161,3 +163,7 @@ instance Show LauncherExceptions where
161163

162164
instance Exception LauncherExceptions
163165

166+
silence :: IO a -> IO a
167+
silence action = case buildOS of
168+
Windows -> hSilence [stdout, stderr] action
169+
_ -> action

cardano-launcher/cardano-launcher.cabal

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ executable cardano-launcher
8282
-- exception handling
8383
, safe-exceptions
8484
, text
85+
, silently
86+
, Cabal
87+
88+
if os(windows)
89+
ghc-options: -optl-mwindows
8590

8691
default-language: Haskell2010
8792
default-extensions: NoImplicitPrelude

nix/.stack.nix/cardano-launcher.nix

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/.stack.nix/default.nix

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stack.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extra-deps:
88
- quickcheck-state-machine-0.6.0 # Used a specific dependency, new release.
99
- pretty-show-1.9.5 # Used for quickcheck-state-machine.
1010
- time-units-1.0.0
11+
- silently-1.2.5.1
1112

1213
- git: https://github.com/input-output-hk/cardano-prelude
1314
commit: 12ab51e27539c9cce042ded0c89efc0ccae6137a

0 commit comments

Comments
 (0)