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

handle Ctrl-C #30

Closed
mnewt opened this issue Nov 16, 2017 · 3 comments
Closed

handle Ctrl-C #30

mnewt opened this issue Nov 16, 2017 · 3 comments
Labels

Comments

@mnewt
Copy link
Contributor

mnewt commented Nov 16, 2017

Closh doesn't process Ctrl-C while a command is running (maybe it doesn't pass it to the child process?). And when Ctrl-C is pressed at the prompt it exits (is that read-line trapping it?).

$ sleep 10
<press Ctrl-C>
<10 seconds later>
$
<closh exits>

Expected outcome is:

  1. Ctrl-C interrupts a child process
  2. At the prompt, Ctrl-C clears whatever, if anything, is written on the command line but otherwise does nothing. This is just my preference as it's the way fish does it and it's nice. The alternative of moving to a new prompt line (like bash) would also work.
@dundalek
Copy link
Owner

Definitely high on the list. We need to handle these things:

  1. Interrupt when clojure code is running (lumo repl does this so I will look for inspiration there)
  2. Send SIGINT signal to the child process (if a command is running)
  3. Cancel the pipeline

I agree when no command is running then clearing the command line would be nice.

@mnewt
Copy link
Contributor Author

mnewt commented Dec 6, 2017

I started testing some of this in node (without lumo). Unfortunately, lumo has a bug where it doesn't respect SIGINT traps (anmonteiro/lumo#191).

After that is dealt with, it looks like we will need to use node's startSigintWatchdog (https://github.com/nodejs/node/blob/master/src/node_util.cc) to trap during execution.

@dundalek
Copy link
Owner

Implemented and released in 0.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants