From 62ca0091f8c37bf0253b2b6897ae472a26b24835 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Thu, 15 Feb 2018 17:05:12 -0800 Subject: [PATCH] "stack ghci" now replaces the process with ghci for signal handling #3821 --- ChangeLog.md | 8 +++++++- src/Stack/Ghci.hs | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 78eecc416a..d745183808 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -52,6 +52,13 @@ Other enhancements: Bug fixes: +* `stack ghci` now replaces the stack process with ghci. This improves + signal handling behavior. In particular, handling of Ctrl-C. To make + this possible, the generated files are now left behind after exit. + The paths are based on hashing file contents, and it's stored in the + system temporary directory, so this shouldn't result in too much + garbage. See + [#3821](https://github.com/commercialhaskell/stack/issues/3821). ## v1.6.5 @@ -108,7 +115,6 @@ Bug fixes: * `stack ghci` now uses correct paths for autogen files with [#3791](https://github.com/commercialhaskell/stack/issues/3791) - ## v1.6.3.1 Hackage-only release with no user facing changes (updated to build with diff --git a/src/Stack/Ghci.hs b/src/Stack/Ghci.hs index 3479a98a5a..e82a3685f2 100644 --- a/src/Stack/Ghci.hs +++ b/src/Stack/Ghci.hs @@ -32,6 +32,7 @@ import Path import Path.Extra (toFilePathNoTrailingSep) import Path.IO hiding (withSystemTempDir) import qualified RIO +import RIO.Process (HasProcessContext, exec, proc, readProcess_) import Stack.Build import Stack.Build.Installed import Stack.Build.Source @@ -51,7 +52,6 @@ import Stack.Types.PackageIdentifier import Stack.Types.PackageName import Stack.Types.Runner import System.IO (putStrLn, putStr, getLine) -import RIO.Process (HasProcessContext, execSpawn, proc, readProcess_) import System.IO.Temp (getCanonicalTemporaryDirectory) #ifndef WINDOWS @@ -368,7 +368,7 @@ runGhci GhciOpts{..} targets mainIsTargets pkgs extraFiles exposePackages = do mconcat (intersperse ", " (map (RIO.display . ghciPkgName) pkgs)) let execGhci extras = do menv <- liftIO $ configProcessContextSettings config defaultEnvSettings - withProcessContext menv $ execSpawn + withProcessContext menv $ exec (fromMaybe (compilerExeName wc) ghciGhcCommand) (("--interactive" : ) $ -- This initial "-i" resets the include directories to