Closed ASBaj closed 6 years ago
Hello, just stumbled on this while looking for something else. If your child process is spawned by the service then this is expected, it is a child process which means it dies when the parent dies. What you want is to detach it so the process becomes a sibling. https://nodejs.org/api/child_process.html#child_process_options_detached
Hi nevercast,
Just wanted to say thank you for pointing that out! I did figure that killing the parent process kills the child process, however, I did not find out that it was possible to detach the process. Thanks very much for linking that!
Hi,
Over the last little while, I've been attempting to create an updater, which is forked as a detached child process. This updater downloads new versions of my scripts, replaces them, and attempts to perform a service restart so the new scripts are in use.
Here is the issue: stopping my service in any way, be it uninstall, stop or restart, kills the child_process. It does not matter how the child process was called, spawn, fork, or exec - as soon as the service goes down, the updater child_process goes down with it.
This is not an issue when running the updater is invoked by the agent through a normal node.js command prompt; it works as expected.
I could not see this in the list of known issues, so I'm reporting this.
Kind Regards.