question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Capture OS signals during prompts

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
marcushultmancommented, Nov 11, 2020

@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.

0reactions
c4sparcommented, Nov 11, 2020

Cool, that would be even better! thanks @marcushultman

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found