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.
如何在 node.js 中生成一个进程并使其无法关闭,尽管父进程已关闭。
var spawn = require("child_process").spawn; var ex = spawn("vlc", ["/var/www/fr.mkv"]);
当我完成打开 VLC 的 node.js 进程时,VLC 关闭并且我不希望它关闭。谢谢你。
将detached选项设置为true。查看文档
detached
true
spawn("vlc", ["/var/www/fr.mkv"], { detached: true })