ora: breaks other `process.on('SIGINT', ...)` handlers

When using ora, other exit related signal handlers fail to run:

// remove the next line, and "cleanup" prints.
require('ora')('Loading unicorns').start().stop();

process.on('SIGINT', function() {
  // never called if ora was ever enabled
  console.log('cleanup');
});

process.kill(process.pid, 'SIGINT');

This is due to: exit-hook used by restore-cursor not being friendly with other on-exit related strategies.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hi! First and foremost thanks for the project. I’m learning how to write spinners for node by looking here 🎉. Also I’d like to give feedback but I don’t feel like it needs to be a new issue. Me and a friend ran on this SIGINT issue using Ora, and this thread was the only link between that behavior and the hideCursor option. We weren’t understanding why Ora was interfering in killing our CLI using ctrl+c. I think this should be mentioned in the readme, at the very least. Did you guys make hideCursor default to on to avoid introducing a breaking change?

One cop-out might be to have an option so that Ora doesn’t hide the cursor. You may still want to hide it yourself but you can then also manage hooks yourself.

👆🏻That leads me to believe it should default to off.