Refactor ./hadrian/ghci.sh for better error messages
authorMatthew Pickering <matthewtpickering@gmail.com>
Wed, 20 Mar 2019 14:12:53 +0000 (14:12 +0000)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Mon, 25 Mar 2019 18:02:27 +0000 (14:02 -0400)
By separating these two lines, if the first command fails then `ghci` is
not loaded. Before it would still load ghci but display lots of errors
about not being able to find modules.

hadrian/ghci.sh

index 4a70946..4c9b9c6 100755 (executable)
@@ -1,3 +1,6 @@
 #!/usr/bin/env bash
 
-ghci $(TERM=dumb CABFLAGS=-v0 . "hadrian/build.cabal.sh" tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci "$@") -fno-code -fwrite-interface -hidir=.hadrian_ghci/interface -O0 ghc/Main.hs
+set -e
+
+GHC_FLAGS=$(TERM=dumb CABFLAGS=-v0 . "hadrian/build.cabal.sh" tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci "$@")
+ghci $GHC_FLAGS -fno-code -fwrite-interface -hidir=.hadrian_ghci/interface -O0 ghc/Main.hs