Closed privatenumber closed 11 months ago
Is your feature request related to a problem? Please describe.
When the logic between spinner.start() & spinner.stop() throws an error and terminates the process, it seems to cause issues with the terminal cursor:
spinner.start()
spinner.stop()
https://github.com/Nutlope/aicommits/pull/154/
So to work around this, the logic block needs to be wrapped in a try-finally to call spinner.stop().
try-finally
Describe the solution you'd like
An exit hook inside spinner to cleanup the readline prompt if the process is about to exit:
spinner
readline
process.on('exit', () => { if (spinnerActive) { // terminate readline } })
Describe alternatives you've considered Delegate try-finally wrappers to user-land, but it's not very ergonomic to do this every time spinner is used.
Additional context Add any other context or screenshots about the feature request here.
Sounds like a no-brainer to me. Care to open a PR?
Is your feature request related to a problem? Please describe.
When the logic between
spinner.start()
&spinner.stop()
throws an error and terminates the process, it seems to cause issues with the terminal cursor:https://github.com/Nutlope/aicommits/pull/154/
So to work around this, the logic block needs to be wrapped in a
try-finally
to callspinner.stop()
.Describe the solution you'd like
An exit hook inside
spinner
to cleanup thereadline
prompt if the process is about to exit:Describe alternatives you've considered Delegate
try-finally
wrappers to user-land, but it's not very ergonomic to do this every timespinner
is used.Additional context Add any other context or screenshots about the feature request here.