Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run ghc for the wrapper in the temp directory to avoid .ghc-environment #24

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

hsenag
Copy link
Member

@hsenag hsenag commented Sep 7, 2019

No description provided.

Some versions of cabal write out .ghc-environment files which can then
break ghc when run from the project folder.

The required working directory is passed in CreateProcess parameters as
changing directory first isn't thread-safe.
callProcess "ghc" ["-o", wrapper_fp, wrapper_hs]
let ghc = (proc "ghc" ["-o", wrapper_fp, wrapper_hs])
{ cwd = Just (takeDirectory wrapper_hs) }
readCreateProcess ghc "" >>= putStr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this putStr for debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to replicate the previous behaviour of callProcess which just passed through stdout directly. There doesn't seem to be a callProcess equivalent if you need a custom CreateProcess value.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use createProcess rather than readCreateProcess then? proc by default inherits the stdout handle.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would work, but then I'd have to copy and paste the bits of callProcess that throw an error if the command fails (or we decide we don't care about that).

@mpickering mpickering merged commit 3e4e760 into haskell:master Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants