diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2016-09-08 08:59:48 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2016-09-09 15:02:34 +0200 |
commit | 65d9597d98ead78198bb747aed4e1163ee0d60d3 (patch) | |
tree | 9601901055332da6fa0a13d28ad853082ec71feb /compiler/main/Hooks.hs | |
parent | a8238a4eb628dcab93e19021b27c0cf2b38ef7d0 (diff) | |
download | haskell-65d9597d98ead78198bb747aed4e1163ee0d60d3.tar.gz |
Add hook for creating ghci external interpreter
Summary:
The external interpreter is launched by calling
'System.Process.createProcess' with a 'CreateProcess' parameter.
The current value for this has the 'std_in', 'std_out' and 'std_err'
fields use the default of 'Inherit', meaning that the remote interpreter
shares the stdio with the original ghc/ghci process.
This patch introduces a new hook to the DynFlags, which has an
opportunity to override the 'CreateProcess' fields, launch the process,
and retrieve the stdio handles actually used.
So if a ghci external interpreter session is launched from the GHC API
the stdio can be redirected if required, which is useful for tooling/IDE
integration.
Test Plan: ./validate
Reviewers: austin, hvr, simonmar, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2518
Diffstat (limited to 'compiler/main/Hooks.hs')
-rw-r--r-- | compiler/main/Hooks.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/main/Hooks.hs b/compiler/main/Hooks.hs index 237101bce0..8d706d8fa5 100644 --- a/compiler/main/Hooks.hs +++ b/compiler/main/Hooks.hs @@ -25,6 +25,7 @@ module Hooks ( Hooks , runRnSpliceHook #ifdef GHCI , getValueSafelyHook + , createIservProcessHook #endif ) where @@ -45,6 +46,7 @@ import CoreSyn import GHCi.RemoteTypes import SrcLoc import Type +import System.Process #endif import BasicTypes @@ -78,6 +80,7 @@ emptyHooks = Hooks , runRnSpliceHook = Nothing #ifdef GHCI , getValueSafelyHook = Nothing + , createIservProcessHook = Nothing #endif } @@ -96,6 +99,7 @@ data Hooks = Hooks , runRnSpliceHook :: Maybe (HsSplice Name -> RnM (HsSplice Name)) #ifdef GHCI , getValueSafelyHook :: Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue)) + , createIservProcessHook :: Maybe (CreateProcess -> IO ProcessHandle) #endif } |