Commit dfac365f authored by Simon Marlow's avatar Simon Marlow Committed by Ben Gamari
Browse files

:cd affects the iserv process too

Test Plan: validate

Reviewers: angerman, austin, bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3395
parent 61ba4518
...@@ -1409,6 +1409,11 @@ changeDirectory dir = do ...@@ -1409,6 +1409,11 @@ changeDirectory dir = do
GHC.workingDirectoryChanged GHC.workingDirectoryChanged
dir' <- expandPath dir dir' <- expandPath dir
liftIO $ setCurrentDirectory 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 :: GHC.GhcMonad m => m SuccessFlag -> m SuccessFlag
trySuccess act = trySuccess act =
......
import System.Directory
import Control.Monad
createDirectory "test"
createDirectory "test/test1"
:cd test
unless ("test1" `elem` getDirectoryContents ".") $ putStrLn "Uh oh."
...@@ -251,3 +251,4 @@ test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) ...@@ -251,3 +251,4 @@ test('StaticPtr', normal, ghci_script, ['StaticPtr.script'])
test('T13202', normal, ghci_script, ['T13202.script']) test('T13202', normal, ghci_script, ['T13202.script'])
test('T13202a', normal, ghci_script, ['T13202a.script']) test('T13202a', normal, ghci_script, ['T13202a.script'])
test('T13466', normal, ghci_script, ['T13466.script']) test('T13466', normal, ghci_script, ['T13466.script'])
test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment