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

Deprecate withProcess/withProcess_ (fixes #25) #26

Merged
merged 3 commits into from
Jun 26, 2019

Conversation

snoyberg
Copy link
Member

@psibi would you mind taking a look at this?

withProcessWait_ config f = bracket
(startProcess config)
stopProcess
(\p -> f p <* checkExitCode p)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why on this case (and in withProcessWait), you have chosen <* as compared to finally ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. If there was an exception in the inner block, we want that exception to propagate. Checking the exit code of the process is irrelevant when we're already about to throw a runtime exception.

Copy link
Member

@psibi psibi left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor question.

@psibi
Copy link
Member

psibi commented Jun 25, 2019

But strangely the test case you have added are failing in CI: https://travis-ci.org/fpco/typed-process/jobs/550165307 (Although it does pass for me locally).

@snoyberg
Copy link
Member Author

I'm guessing that's a timing issue, I'll try extending the sleep and seeing what happens.

@snoyberg
Copy link
Member Author

Nope, that didn't fix it at all, something else is going on.

@psibi
Copy link
Member

psibi commented Jun 26, 2019

@snoyberg I think it might have got to do something with GHC. I changed the resolver to 9.21 and I was able to reproduce the test failures consistently.

@snoyberg
Copy link
Member Author

You're awesome @psibi!

@snoyberg
Copy link
Member Author

OK, looks like the issue is that waitForProcess isn't interruptible, and therefore the process doesn't get stopped correctly. But only on older GHCs. I'm going to comment out these two test cases and link to this comment as an explanation for why. Thanks for helping me not be crazy here @psibi, much appreciated!

@snoyberg
Copy link
Member Author

Last test failure, funnily enough, is the Stack bug that initially encouraged the creation of this PR.

@snoyberg snoyberg merged commit cb02c59 into master Jun 26, 2019
@snoyberg snoyberg deleted the 25-deprecate-with-process branch June 26, 2019 04:52
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.

2 participants