我一开始试图杀死一个进程,我执行了
exec = require('child_process').exec;
exec('kill xxx', function(error, stdout, stderr) {
if (error) {
console.log('exec error: ', error);
}else{
console.log(stdout)
}
});
Run Code Online (Sandbox Code Playgroud)
我注意到 kill 程序可能启动了一个子进程,其输出无法在此处作为 stdout 捕获。
那么我通常可以捕获这些似乎与代码不太相关的控制台输出吗?