You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✔ The first colored line display well but after the spawn
✖ The second colored line wrong
const{ spawn }=require('child_process');asyncfunctiontest(){console.log('\x1b[36m%s\x1b[0m','I am cyan');awaitrun('echo Hello world!');console.log('\x1b[36m%s\x1b[0m','I am cyan');asyncfunctionrun(scrpt){constcmd=spawn('bash',['-c',scrpt],{stdio: 'inherit'});returnnewPromise((resolve)=>{cmd.on('close',(code)=>resolve(code));});}}test();
Activity
bmuenzenmeyer commentedon Nov 11, 2022
This question is idle and left unanswered for years now.
I am going to circle back in a couple weeks to see if we can close as no-longer relevant.
FWIW, I ran the above in a Node 16.X REPL and got correct behavior:
bmuenzenmeyer commentedon Dec 2, 2022
closing per the above plan