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

Process interrupt ignored when using cli-progress v3.11 #126

Open
wmelton opened this issue Jun 9, 2022 · 7 comments
Open

Process interrupt ignored when using cli-progress v3.11 #126

wmelton opened this issue Jun 9, 2022 · 7 comments
Labels

Comments

@wmelton
Copy link

wmelton commented Jun 9, 2022

When using cli-progress, if you attempt to interrupt the process using ctrl+c the command is ignored until the process fully completes.

Reading through the readme I may have missed how this is supposed to be handled, but I do not see any config options to specify how to handle a kill request from a user.

@AndiDittrich
Copy link
Member

an option called gracefulExit has been added to v3.11 (see https://github.com/npkgz/cli-progress/blob/master/CHANGES.md) which restores the terminal state on SIGINT/SIGTERM

@hfabio
Copy link

hfabio commented Jun 9, 2022

an option called gracefulExit has been added to v3.11 (see https://github.com/npkgz/cli-progress/blob/master/CHANGES.md) which restores the terminal state on SIGINT/SIGTERM

even using this option I still face the same behaviour

@AndiDittrich
Copy link
Member

set gracefulExit: false to restore the "old" behaviour. i've to check the node.js docs regarding the SIGINT listener

@AndiDittrich
Copy link
Member

from the docs

'SIGTERM' and 'SIGINT' have default handlers on non-Windows platforms that reset the terminal mode before exiting with code 128 + signal number. If one of these signals has a listener installed, its default behavior will be removed (Node.js will no longer exit).

i wasn't aware of this side effect. sry!

the question is how to solve this (putting and process.exit on the end of the listener may avoids users to add their own actions..)

@AndiDittrich AndiDittrich changed the title Process interrupt ignored when using cli-progress Process interrupt ignored when using cli-progress v3.11 Jun 9, 2022
@wmelton
Copy link
Author

wmelton commented Jun 23, 2022

This is a great library! The ability to hard stop a script from cli is essential though.

@AndiDittrich
Copy link
Member

set gracefulExit: false - this will be the default value in the upcoming hotfix

@ivanakcheurov
Copy link

I use cli-progress 3.12.0
I tried:

const bar1 = new cliProgress.SingleBar({gracefulExit: true}, cliProgress.Presets.shades_classic);

and

const bar1 = new cliProgress.SingleBar({gracefulExit: false}, cliProgress.Presets.shades_classic);

both don't kill the node process after hitting ctrl+c in bash (the progress continues to run and the node process continues to work).

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

4 participants