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

hatch run handles keyboard interrupt (but maybe should defer to child) #1647

Open
bluss opened this issue Jul 28, 2024 · 0 comments
Open

hatch run handles keyboard interrupt (but maybe should defer to child) #1647

bluss opened this issue Jul 28, 2024 · 0 comments

Comments

@bluss
Copy link

bluss commented Jul 28, 2024

Inside a hatch project, try this:

hatch run python
<Ctrl-C>

The result is:

KeyboardInterrupt
>>> 
Aborted!

At this point the user is dumped back to the shell but the shell is not in a good state (hatch's child process python is in fact still running.)

Compare with just this, which could be the desired behaviour:

python
<Ctrl-C>
>>> 
KeyboardInterrupt
>>>

(python also still running here, but it keeps control of the terminal)

In short: "hatch run" is not transparent because python inside hatch run does not behave the same way that plain python does. Letting the child process handle Ctrl-c as it wants to do will help multiple applications (another example: jupyterlab will ask the user to quit or not, with an interactive prompt, if you use Ctrl-c, and ipykernel will interrupt current computation but not quit, if you sent SIGINT.).

Hatch, version 1.12.0
platform: linux (x86_64)

@bluss bluss changed the title hatch run handles keyboard interrupt hatch run handles keyboard interrupt (but maybe should defer to child) Jul 28, 2024
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

No branches or pull requests

1 participant