javascript - How to start an entirely new process in node.js (not child)? -
the answers i've seen starting process using called child_process. want spawn entirely new process independent current running node process, possible?
you can spawn child process in detached state, ignore outputs, , remove child parents event loop child.unref().
this code start somescript.sh, , exit while keeping somescript.sh running.
var spawn = require('child_process').spawn; var child = spawn(__dirname + '/somescript.sh', [], { detached: true , stdio: [ 'ignore', 'ignore', 'ignore' ] }); child.unref(); for more detailed information , alternatives (such logging output / etc), take @ documentation spawn. there other examples there well:
http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
Comments
Post a Comment