node child process: will it always terminate by itself?
问题 I have code to spawn child process like this: const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr'], { detached: true }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ls.stderr.on('data', (data) => { console.log(`stderr: ${data}`); }); ls..on('error', (data) => { console.log(`error: ${data}`); }); ls.on('close', (code) => { console.log(`child process exited with code ${code}`); }); Till now, I can console message from stdout and stderr,