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

[RFC] Terminate ghci process before waiting for it. #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fisx
Copy link

@fisx fisx commented Feb 12, 2016

May be related to hspec/sensei#30.

This change is based on the unconfirmed theory that pressing ^C repeatedly sometimes leaves ghci processes running, with the same symptoms as described in the comment near this change.

Breaks the test suite, but it does have the expected and desired effect that the reaction on ^C is immediate.

Before I look at the test suite: is this worth investigating?

thanks-

This change is based on the unconfirmed theory that
pressing ^C repeatedly sometimes leaves ghci processes
running, with the same symptoms as described in the comment
near this change.
@sol
Copy link
Owner

sol commented Feb 13, 2016

@fisx Is the assumption something like:

  1. The user presses ctrl-c, doctest receives SIGINT but the forked ghci does not receive SIGINT
  2. ghci is still busy with something so closing stdin does not result immediate termination and waitForProcess blocks
  3. The user presses ctrl-c again, doctest gets killed but the ghci process is still there

By doing a terminateProcess first, ghci gets interrupted ==> closing stdin has the intended effect of terminating ghci and waitForProcess does not block any more. Is that your reasoning?

I think for me to understand all the details I would need to read up on POSIX process groups and signal handling again.

In addition I'm puzzled whether masking any async exception until ghci is terminated would be of any benefit.

@fisx
Copy link
Author

fisx commented Feb 13, 2016

[...] Is that your reasoning?

Yes, thanks for the much better explanation.

In addition I'm puzzled whether masking any async exception until ghci is terminated would be of any benefit.

You mean, catching and dropping extra SIGINTs? that would certainly solve the problem of ghci killing my machine every now and then.

The advantage of my idea is that the first ^C has an immediate effect.

Of course all this is a lot less relevant if you only have test suites that run less than 3 seconds. :-)

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