Commit 9048c3df authored by rwbarton's avatar rwbarton
Browse files

Don't print "Loaded GHCi configuration" message in ghc -e (#11478)

Summary:
Also don't print it if the user specifically requested
non-verbose output with -v0.

Since this means there is no longer any test that checks
for the message, add such a test.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1817

GHC Trac Issues: #11478
parent 2df42216
......@@ -527,7 +527,11 @@ runGHCi paths maybe_exprs = do
do runInputTWithPrefs defaultPrefs defaultSettings $
runCommands $ fileLoop hdl
liftIO (hClose hdl `catchIO` \_ -> return ())
liftIO $ putStrLn ("Loaded GHCi configuration from " ++ file)
-- Don't print a message if this is really ghc -e (#11478).
-- Also, let the user silence the message with -v0
-- (the default verbosity in GHCi is 1).
when (isNothing maybe_exprs && verbosity dflags > 0) $
liftIO $ putStrLn ("Loaded GHCi configuration from " ++ file)
--
......
......@@ -41,3 +41,7 @@ T9905:
T9905b:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import qualified Data.List as L" -e "L.sort [2,1]"
# Ensure that ghc -e does not output extra messages about GHCi configuration files
T11478:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -ghci-script T11478.script -e 3
......@@ -16,3 +16,4 @@ test('T7299', req_interp, run_command, ['$MAKE --no-print-directory -s T7299'])
test('T9086', req_interp, run_command, ['$MAKE --no-print-directory -s T9086'])
test('T9905', req_interp, run_command, ['$MAKE --no-print-directory -s T9905'])
test('T9905b', req_interp, run_command, ['$MAKE --no-print-directory -s T9905b'])
test('T11478', req_interp, run_command, ['$MAKE --no-print-directory -s T11478'])
......@@ -54,3 +54,10 @@ T10408:
# and not be ignored when `-ignore-dot-ghci` is specified.
'$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci \
-ghci-script T10408A.script -ghci-script T10408B.script < /dev/null
.PHONY: T11389
T11389:
# Test that "Loaded GHCi configuration" message is printed by default
# (without -v0)
'$(TEST_HC)' $(TEST_HC_OPTS) --interactive -ignore-dot-ghci \
-ghci-script T11389.script < /dev/null | grep 'configuration'
"T10408A"
Loaded GHCi configuration from T10408A.script
"T10408B"
Loaded GHCi configuration from T10408B.script
Loaded GHCi configuration from T11389.script
......@@ -240,3 +240,5 @@ test('T10576b', expect_broken(10576), ghci_script, ['T10576b.script'])
test('T11051a', normal, ghci_script, ['T11051a.script'])
test('T11051b', normal, ghci_script, ['T11051b.script'])
test('T11266', check_stdout(lambda *args: 1), ghci_script, ['T11266.script'])
test('T11389', req_interp, run_command, ['$MAKE -s --no-print-directory T11389'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment