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

Commit

Permalink
Disable terminal GUI on Windows (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroto Shioi authored and ksaric committed Oct 23, 2019
1 parent 8abae42 commit cd154b0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cardano-launcher/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ module Main where
import Cardano.Prelude
import qualified Prelude

import Distribution.System (OS (Windows), buildOS)
import System.Environment (setEnv)
import System.Exit (exitWith)
import System.IO.Silently (hSilence)

import Formatting (bprint, build, formatToString)
import Formatting.Buildable (Buildable (..))
Expand Down Expand Up @@ -39,7 +41,7 @@ import Data.Text.Lazy.Builder (fromString, fromText)

-- | Main function.
main :: IO ()
main = do
main = silence $ do

logConfig <- defaultConfigStdout

Expand Down Expand Up @@ -161,3 +163,7 @@ instance Show LauncherExceptions where

instance Exception LauncherExceptions

silence :: IO a -> IO a
silence action = case buildOS of
Windows -> hSilence [stdout, stderr] action
_ -> action
5 changes: 5 additions & 0 deletions cardano-launcher/cardano-launcher.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ executable cardano-launcher
-- exception handling
, safe-exceptions
, text
, silently
, Cabal

if os(windows)
ghc-options: -optl-mwindows

default-language: Haskell2010
default-extensions: NoImplicitPrelude
Expand Down
2 changes: 2 additions & 0 deletions nix/.stack.nix/cardano-launcher.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nix/.stack.nix/default.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extra-deps:
- quickcheck-state-machine-0.6.0 # Used a specific dependency, new release.
- pretty-show-1.9.5 # Used for quickcheck-state-machine.
- time-units-1.0.0
- silently-1.2.5.1

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

0 comments on commit cd154b0

Please sign in to comment.