From d32e91228af4bb77dedf37171b0c4ac879241005 Mon Sep 17 00:00:00 2001 From: Hiroto Shioi Date: Wed, 23 Oct 2019 17:03:44 +0900 Subject: [PATCH] WIP diable GUI console --- cardano-launcher/app/Main.hs | 8 +++++++- cardano-launcher/cardano-launcher.cabal | 2 ++ nix/.stack.nix/cardano-launcher.nix | 2 ++ nix/.stack.nix/default.nix | 1 + stack.yaml | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cardano-launcher/app/Main.hs b/cardano-launcher/app/Main.hs index f29c088a..edba77b5 100644 --- a/cardano-launcher/app/Main.hs +++ b/cardano-launcher/app/Main.hs @@ -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 (..)) @@ -39,7 +41,7 @@ import Data.Text.Lazy.Builder (fromString, fromText) -- | Main function. main :: IO () -main = do +main = silence $ do logConfig <- defaultConfigStdout @@ -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 diff --git a/cardano-launcher/cardano-launcher.cabal b/cardano-launcher/cardano-launcher.cabal index e09f8af0..4f81c439 100644 --- a/cardano-launcher/cardano-launcher.cabal +++ b/cardano-launcher/cardano-launcher.cabal @@ -82,6 +82,8 @@ executable cardano-launcher -- exception handling , safe-exceptions , text + , silently + , Cabal default-language: Haskell2010 default-extensions: NoImplicitPrelude diff --git a/nix/.stack.nix/cardano-launcher.nix b/nix/.stack.nix/cardano-launcher.nix index 92246486..be83df32 100644 --- a/nix/.stack.nix/cardano-launcher.nix +++ b/nix/.stack.nix/cardano-launcher.nix @@ -49,6 +49,8 @@ (hsPkgs.iohk-monitoring) (hsPkgs.safe-exceptions) (hsPkgs.text) + (hsPkgs.silently) + (hsPkgs.Cabal) ]; }; "mock-daedalus-frontend" = { diff --git a/nix/.stack.nix/default.nix b/nix/.stack.nix/default.nix index 37a40776..2e1df233 100644 --- a/nix/.stack.nix/default.nix +++ b/nix/.stack.nix/default.nix @@ -5,6 +5,7 @@ "quickcheck-state-machine" = (((hackage.quickcheck-state-machine)."0.6.0").revisions).default; "pretty-show" = (((hackage.pretty-show)."1.9.5").revisions).default; "time-units" = (((hackage.time-units)."1.0.0").revisions).default; + "silently" = (((hackage.silently)."1.2.5.1").revisions).default; "base58-bytestring" = (((hackage.base58-bytestring)."0.1.0").revisions).default; "hedgehog" = (((hackage.hedgehog)."1.0").revisions).default; "micro-recursion-schemes" = (((hackage.micro-recursion-schemes)."5.0.2.2").revisions).default; diff --git a/stack.yaml b/stack.yaml index 385abe10..dad0c843 100644 --- a/stack.yaml +++ b/stack.yaml @@ -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