📜  在 nodejs 进程退出时运行另一个进程 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:53.278000             🧑  作者: Mango

代码示例1
const spawn = require('child_process').spawn;

process.on('exit', () => {
   const child = spawn('node', ['some_other_script.js'], {
      detached: true,
      stdio: 'ignore'
   });

   child.unref();
});