Tag: detach

node.js:如何在前景中产生分离的子节点并退出

根据child_process.spawn 的文档 ,我期望能够在前台运行一个subprocess,并允许节点进程自己退出,如下所示: handoff-exec.js : 'use strict'; var spawn = require('child_process').spawn; // this console.log before the spawn seems to cause // the child to exit immediately, but putting it // afterwards seems to not affect it. //console.log('hello'); var child = spawn( 'ping' , [ '-c', '3', 'google.com' ] , { detached: true, stdio: 'inherit' } […]