Open wmelton opened 2 years ago
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
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
set gracefulExit: false
to restore the "old" behaviour. i've to check the node.js docs regarding the SIGINT listener
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..)
This is a great library! The ability to hard stop a script from cli is essential though.
set gracefulExit: false - this will be the default value in the upcoming hotfix
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).
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.