diff --git a/ghcid.cabal b/ghcid.cabal index 5dec709..f079d5d 100644 --- a/ghcid.cabal +++ b/ghcid.cabal @@ -34,6 +34,10 @@ library process >= 1.1, ansi-terminal, cmdargs >= 0.10 + if os(windows) + build-depends: Win32 + else + build-depends: unix exposed-modules: Language.Haskell.Ghcid diff --git a/src/Language/Haskell/Ghcid.hs b/src/Language/Haskell/Ghcid.hs index c31febf..74e8953 100644 --- a/src/Language/Haskell/Ghcid.hs +++ b/src/Language/Haskell/Ghcid.hs @@ -21,6 +21,7 @@ import Data.Maybe import Data.IORef import Control.Applicative import Data.Unique +import System.Posix.Signals (installHandler, Handler(Catch), sigINT, sigTERM) import System.Console.CmdArgs.Verbosity @@ -191,6 +192,9 @@ startGhciProcess process echo0 = do -- so try a showModules to capture the information again r2 <- if any isLoading r1 then return [] else map (uncurry Loading) <$> showModules ghci execStream ghci "" echo0 + + installHandler sigINT (Catch $ quit ghci) Nothing + return (ghci, r1 ++ r2)