-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Spinner pauses when using child_process.execSync
#86
Comments
JavaScript is single-threaded, so running a synchronous function blocks everything else, including Ora. Use |
If so, why it does work and doesn't pause the spinner? async function run() {
spinner.start('Installing packages...');
await install('npm install');
spinner.succeed('Installed');
}
function install() {
return new Promise((resolve, reject) => {
exec('npm install').on('close', code => {
if (code === 0) {
resolve();
}
reject();
});
});
}
run(); |
@jediyozh Because |
@sindresorhus of course but I made it synchronous with Promise, no? |
@jediyozh No. I would recommend reading up on how promises and async/await work. In short, |
@sindresorhus Got it. Thanks for the explanation and for the great tool 👍 |
Also, I would recommend |
@sindresorhus I will look at this |
Spinner pauses when I start a command using
child_process.execSync
.Is this intended? Did I need to manually render the frames using
ora.render()
?The text was updated successfully, but these errors were encountered: