我想在另一个进程退出后运行一个进程。
例如,如果我正在运行一个节点 JS 文件并点击CTRL+ C,它应该关闭当前文件并从另一个 JS 文件运行另一个进程
类似的东西(伪代码):
process.on('exit', () => {
console.log("exiting")
}).then( //I am conscious it's wrong to put like that
//open another js file and run this process
);
Run Code Online (Sandbox Code Playgroud)