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

Correctly terminate child processes to fix ./pants repl bug #10930

Merged
merged 1 commit into from Oct 9, 2020

Conversation

gshuflin
Copy link
Contributor

@gshuflin gshuflin commented Oct 8, 2020

Problem

Currently if a user hits Ctrl-C while at the Python REPL spawned by ./pants repl on Python targets, pants will quit but the repl process will remain running, listening to stdin on the terminal pants just exited in some kind of indeterminate state, which screws up further input into that terminal.

Solution

The problem was that when pants receives a SIGINT signal from the user hitting Ctrl-C, it sends SIGINT to all child processes. However, SIGINT does not actually terminate a Python REPL - it prints the text "KeyboardInterrupt" and continues to run. In order to actually shut down the Python process (or any other process that has similar behavior with respect to SIGINT), we need to send the SIGTERM signal instead.

Result

Hitting Ctrl-C when at the Python REPL now correctly terminates all of pants, pantsd, and the underlying Python REPL process.

[ci skip-build-wheels]

[ci skip-rust]
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling d1e2584 on gshuflin:fix-repl-bug into dbf744f on pantsbuild:master.

@gshuflin gshuflin merged commit 9100678 into pantsbuild:master Oct 9, 2020
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

3 participants