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

Disable terminal GUI on Windows #330

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile and link the code as a windows executable (WinMain)?


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