The child_process module launches the children with piped stdout and
stdin, and most processes will exit when they try to write to or read
from a broken pipe (is your spawned app printing something to
stdout?).  I don't know of any existing module to launch children
unpiped, but it might not be too hard to make one.

Alternatively, have node launch a process that then launches your
child process detached (On Linux, something like 'screen -dmS foo java
-jar myapplication.jar' or 'gnome-terminal --execute java -jar
myapplication.jar', on Windows 'cmd /c start "foo" "java -jar
myapplication.jar"').  This has the (possibly desirable) side effect
of creating a visible/accessible terminal/console window for the newly
spawned application.

On Mar 1, 7:47 am, Ben Noordhuis <[email protected]> wrote:
> On Thu, Mar 1, 2012 at 16:32, Rafael Brizola <[email protected]> wrote:
> > My problem is: if I kill the nodejs process, my application (child
> > process) dies too. I figure out that this is the normal behaviour, but
> > there is a way to keep my child process running independently if the
> > parent process is running or not?
>
> It depends on how you kill the parent process. Pressing Ctrl-C, for
> instance, will send the SIGINT to both the parent and the child. What
> you'd do in that particular case is register a process.on('SIGINT')
> listener that calls process.exit().

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to