我正在尝试使用NodeJS child_process
启动一个进程,该进程本身产生了另一个进程。我正在尝试捕获孙子进程stdout或检测到它关闭。出现了一些问题。
const spawn = require('child_process').spawn;
let childProcess = spawn('pathToExe', ['exeArgs'], {stdio: 'pipe'});
childProcess.stdout.on('data', (data) => {
// Here I can capture the child process STDOUT
// The child process closes instantly after spawning the 'grandchild'
});
我如何查看子进程产生了哪些子进程,并检测其何时关闭或退出?