-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Understanding the behaviour of SIGINT #85
Comments
@SamVerschueren is there any other way to do cleanups? |
I don't have anything special set up to handle SIGINT calls. So what you are asking is a way to send SIGINT to a subprocess? |
I think @rprieto explained the problem. |
Thanks it's interesting to hear there's no special handling. The small code samples above are all that's needed to reproduce. I'll run some more tests to understand why |
@rprieto when silent renderer is used then it’s working ok |
I have similar problem where I'd like to run some cleanup code after terminating child processes that were run by Listr. I'm looking at https://github.com/Tapppi/async-exit-hook and try to integrate it but it seems not to affect rendering process of Listr which I'd like it to do. @SamVerschueren do you think this can be added to Listr? |
Weird, but https://github.com/Tapppi/async-exit-hook isn't working either with a promise when used together with Listr. |
I can confirm it's working with |
I tracked down the issue to sindresorhus/log-update#17 which kinda makes sense since both listr-update-renderer and listr-verbose-renderer are using cli-cursor as a dependency. But since it's closed, I'm not sure if this is still affect it or something else. Maybe @sindresorhus could help? |
Thanks for getting to the bottom of this!! 👍 The update renderer uses I'm not sure about the verbose renderer. The bug was apparently fixed in |
Hmm, I’m not sure anymore. I can test it later today and let you know. I also noticed outdated dependency and I’ll do a PR with an update after I tested it. |
This version should fix issues related to processing of SIGINT signal. See sindresorhus/log-update#17. Related to SamVerschueren/listr#85
Just an update here: after upgrading However this doesn't solve all edge cases in regard of termination, but at least this allows us to hook into and modify the behavior ourselves. One issue I'm still seeing is when using |
I tested with verbose renderer and I still can see the bug. I'm not sure why, though. |
I'm trying to understand how Listr responds to SIGINT, compared for example to
async.series
. Here's two simple examples where we see the different behaviour.When running
async.series
async.series
moves on to the next onebeforeExit
event is emitted, and Node terminatesClick here to expand the async.series sample code
When running
Listr
sleep
process exitingbeforeExit
event is not triggered$ node test.js ⠦ Sleep Sleep Sleep ^C SIGINT exit 130
Click here to expand the Listr version
Do you mind explaining how Listr handles this? I'd really like
beforeExit
to be emitted as normal so I can run some cleanup tasks.The text was updated successfully, but these errors were encountered: