-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
using signal-exit in Electron causes Ctrl+C in terminal to stop working #49
Comments
Please have a look |
From what I can understand the problem is caused by the |
when `ora` hides the cursor... it installs a SIGINT handler to clean up the hiding of the cursor. this causes major unreliability with ctrl+c handling. ``` // re: hideCursor: false, ugh, otherwise ctrl+c doesn't work reliably // sindresorhus/ora#27 // tapjs/signal-exit#49 ```
when `ora` hides the cursor... it installs a SIGINT handler to clean up the hiding of the cursor. this causes major unreliability with ctrl+c handling. ``` // re: hideCursor: false, ugh, otherwise ctrl+c doesn't work reliably // sindresorhus/ora#27 // tapjs/signal-exit#49 ```
I'm running into this issue too. In my case I was trying to use Ink with ts-node or tsx (both wouldn't quit on CTRL-C). It seems that the problem is caused by a deadlock between signal-exit and another module (eg. tsx) both listening for
My thought process when thinking about a solution for this is that ideally node would expose an API to listen for SIGINT events without changing the default behaviour of exiting the program but without that signal-exit, tsx and every other tool with this use-case needs to put themselves in charge of deciding whether to continue exiting or not. This will only ever work if one program is in charge so they would somehow need to decide this amongst themselves. One way to achieve this would be to make a small So in summary I think the best solution is for all tools which listen for SIGINT/SIGTERM to be updated to use signal-exit for this instead of handling it themselves. |
Hah, yeah, it looks like we're all trying to stay out of each others' way, so no one goes first, like a bunch of overly polite people who can't walk through a door. I agree that the best would be for anyone trying to implement that behavior to use this module, which just does that one thing, but I'm not sure how to make it work otherwise. Maybe a "ignoreOtherSignalHandlers" option, or something? Without some explicit indication, there's no way to know whether a handler was intending to be unobtrusive or actually handle the event. One idea would be for signal-exit to be even more sneaky in how it assigns listeners, by hackily monkey-patching So really no other way forward with this, I think. |
Running the code below in Electron app causes hitting
Ctrl+C
in the terminal to not close Electron.I tried to isolate the problem to found out if it's a problem of Electron or problem of signal-exit but I wasn't able to. I tried subscribing to
process
events and overridingprocess.emit
andprocess.reallyExit
but without success.The text was updated successfully, but these errors were encountered: