child-process-promise
child-process-promise copied to clipboard
How to use capture with async/await?
Hi, I'm trying to capture the stdout
of a spawn
process that uses await, here is an example:
const { childProcess } = await spawn('yarn', ['install'], { capture: ['stdout'] });
console.log(childProcess.stdout.toString()); // returns [object Object]
I'm would like to log the complete stdout of the process once this completes. Previously used {stdio: 'inherit'}
but since there are concurrent process it's not possible to differentiate the different processes stdout
.
Any help is much appreciated, many thanks!
Yes, that's a problem. I'd suggest using https://github.com/nkashyap/child-process-es6-promise instead