Child process variable doesn't die with process?

Wednesday, July 9, 2014

I am spawning a process using child_process's .spawn like this:



prc = spawn('java', ['-jar', '-Xmx512M', 'jarfile.jar']);


Which works just fine, however when the process ends, the prc variable is still alive with all the data, for example:



# console.log(prc.pid);
# 32407


But if I try to check if that pid exists in my linux system:



# kill -0 32407
# bash: kill: (32407) - No such process


Is this simply the behaviour of child_process.spawn? Are there any workarounds?







http://ift.tt/1zoJ201