Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
鉴于我做了类似的事情:
shelljs.exec('someLongrunningCommand', {async: true})
如何在同一脚本中发送 SIGINT 或以其他方式取消此过程?
您可以通过使用subprocess.kill()方法发送 SIGINT 或 SIGHUP 信号来取消进程,如下所示:
const shell = require('shelljs'); let process = shell.exec('someLongrunningCommand', { async: true }); // Here you stop the process process.kill('SIGINT');