Capture OS signals during prompts
See original GitHub issueI have an application that needs to capture and handle OS signals (SIGINT), but it seems like inputs and Select has hardcoded logic for control+c, ending with a Deno.exit(0)
. I would like to be able to tell cliffy to not exit immediately, but to give me control to properly clean things up before exiting. I’d be up for making a PR for any solution that is of interest. One idea is to offer a callback option.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Is it possible to capture a Ctrl+C signal (SIGINT) and run ...
You can use the os/signal package to handle incoming signals. Ctrl + C is SIGINT, so you can use this to trap os.Interrupt...
Read more >How can I handle SIGINT trap with a user prompt in shell ...
The simple code below illustrates all of this. It sets a trap signal handler, spawns 3 children, then goes into an endless wait...
Read more >Introduction To Unix Signals Programming
Signals, to be short, are various notifications sent to a process in order to notify it of various "important" events. By their nature,...
Read more >OS Signals | Manual
Concepts. Deno.addSignalListener() can be used to capture and monitor OS signals. Deno.removeSignalListener() can be used to stop watching the signal.
Read more >Bash Trap Signals | Capture CTRL+C [Practical Examples]
Bash capture SIGINT, SIGHUP, SIGKILL signals inside script and execute clean function. ... the command currently in execution upon the receipt of a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@c4spar I’ve opened another issue https://github.com/denoland/deno/issues/8343 that would help solve this. If we could use another TTY mode that forwards keystrokes, but handles interrupts/suspend, the whole problem disappears.
Cool, that would be even better! thanks @marcushultman