summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 71be20c20e..deee24ab33 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -1409,6 +1409,11 @@ changeDirectory dir = do
GHC.workingDirectoryChanged
dir' <- expandPath dir
liftIO $ setCurrentDirectory dir'
+ dflags <- getDynFlags
+ -- With -fexternal-interpreter, we have to change the directory of the subprocess too.
+ -- (this gives consistent behaviour with and without -fexternal-interpreter)
+ when (gopt Opt_ExternalInterpreter dflags) $
+ lift $ enqueueCommands ["System.Directory.setCurrentDirectory " ++ show dir']
trySuccess :: GHC.GhcMonad m => m SuccessFlag -> m SuccessFlag
trySuccess act =