From 7cc6551a453c94c975bb0fec7bff40516aa9b2ee Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 30 Jan 2017 19:10:36 -0800 Subject: [PATCH] Have ghci include CWD if configured with no packages #2878 --- ChangeLog.md | 5 ++++- src/Stack/Ghci.hs | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 2a1a9cbef3..e40ded6e4d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -40,7 +40,7 @@ Other enhancements: * Internal cleanup: configuration types are now based much more on lenses * `stack build` and related commands now allow the user to disable debug symbol stripping with new `--no-strip`, `--no-library-stripping`, and `--no-executable-shipping` flags, - closing [#877](https://github.com/commercialhaskell/stack/issues/877). + closing [#877](https://github.com/commercialhaskell/stack/issues/877). Also turned error message for missing targets more readable ([#2384](https://github.com/commercialhaskell/stack/issues/2384)) * `stack haddock` now shows index.html paths when documentation is already up to date. Resolved [#781](https://github.com/commercialhaskell/stack/issues/781) @@ -52,6 +52,9 @@ Other enhancements: shows warning suggesting to run `apt-get update` or similar, depending on the OS. ([#2898](https://github.com/commercialhaskell/stack/issues/2898)) +* When `stack ghci` is run with a config with no packages (e.g. global project), + it will now look for source files in the current work dir. + ([#2878](https://github.com/commercialhaskell/stack/issues/2878)) Bug fixes: diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index c03d977d69..56d4a104ef 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -351,10 +351,11 @@ runGhci GhciOpts{..} targets mainIsTargets pkgs = do menv <- liftIO $ configEnvOverride config defaultEnvSettings execSpawn menv (fromMaybe (compilerExeName wc) ghciGhcCommand) - ("--interactive" : - -- This initial "-i" resets the include directories to not - -- include CWD. - "-i" : + (("--interactive" : ) $ + -- This initial "-i" resets the include directories to + -- not include CWD. If there aren't any packages, CWD + -- is included. + (if null pkgs then id else ("-i" : )) $ odir <> pkgopts <> ghciArgs <> extras) interrogateExeForRenderFunction = do menv <- liftIO $ configEnvOverride config defaultEnvSettings