child-process-promise icon indicating copy to clipboard operation
child-process-promise copied to clipboard

How to use capture with async/await?

Open am opened this issue 6 years ago • 1 comments

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!

am avatar Jan 30 '18 15:01 am

Yes, that's a problem. I'd suggest using https://github.com/nkashyap/child-process-es6-promise instead

Karolusrex avatar Feb 15 '18 10:02 Karolusrex