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
Ora swallows stdout just before .stop()
#90
Comments
spinner.stop()
.stop()
I just experienced the same issue. I resolved it by removing the linebreak at the end of text. Try removing this and see if that works as a temporary fix. |
Actually, re-opening as it's swallowing my debug logging. If ora is still spinning, it just eats any stdout / stderr until stopped. |
@IssueHunt has funded $30.00 to this issue.
|
//NOTE #97 is related |
Also, theoretically, implementing this with minor additions would allow adding multiple spinners. But I still don't think that is worth the trouble. Should we maybe provide a method on spinner to print some text above it instead? It's simpler and doesn't require changing stream. (Plus, even if we do change stream, we can handle just writing to it, but handling all the tty-specific methods is more complex than everything the lib does so far.) |
It would be nice to support normal |
But if the |
You can override Because when you override, you have control of Example: const ora = require('ora');
const consoleLog = console.log;
console.log = (text) => {
spinner.text += '\n' + text;
};
const spinner = ora({
text: 'spinning...',
color: 'yellow'
});
spinner.start();
setTimeout(() => {
console.log('STOP');
spinner.succeed(spinner.text);
console.log = consoleLog;
console.log('It works');
}, 1000); Output: ✔ spinning...
STOP
It works |
@ngocdaothanh |
Yeah when there are too many lines, there's this problem: |
I have a significant problem with this when I have to write test cases for my CLI commands. I can't write tests for stdout because they're gone. |
It looks as though ora swallows any stdout happening just before the
.stop()
.Example
The text was updated successfully, but these errors were encountered: