Handle :cd in external interpreter in a more robust way
ClosedPublic

Authored by watashi on Dec 13 2018, 10:43 PM.

Details

Summary

We used to enqueue another command to change directory in the external
interpreter subprocess, this is not as robust as:

  • it can fail with -fno-implict-import-qualified;
  • it doesn't work when we setGHCiMonad to something other than IO.

Neither of them works if directory package is hidden though.

Test Plan
$ inplace/bin/ghc-stage2 --interactive # -fexternal-interpreter
GHCi, version 8.7.20181213: http://www.haskell.org/ghc/  :? for help
Prelude> :cd ..
Prelude> System.Directory.getCurrentDirectory
"/data/users/watashi"
Prelude> :!pwd
/data/users/watashi
Prelude>
Leaving GHCi.
./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
watashi created this revision.Dec 13 2018, 10:43 PM
watashi updated this revision to Diff 19149.Dec 14 2018, 12:50 AM

rebase && ./validate

simonmar accepted this revision.Dec 14 2018, 2:35 AM

Yes, that's better

This revision is now accepted and ready to land.Dec 14 2018, 2:35 AM
This revision was automatically updated to reflect the committed changes.