Closed simon-robertson closed 7 years ago
This behavior is by design. Starting/stopping from the service manager would never have listeners attached, whereas starting/stopping from another node process would. The events are relative to the service, not the process. A process can stop, but the default action of the service is to remain active and attempt to restart the process.
Can you describe your use case in a little more detail? It sounds like you need an event to bubble up from the process to the service, but I'm unclear how you'd be handling that.
Closing due to age/lack of response.
Running code cannot reliably determine the state of an installed service.
The
start
andstop
events are not emitted when an installed service is started or stopped via a service manager. The only time they seem to be emitted is when the node-windows Servicestart()
andstop()
functions are called directly, or one the other functions such asuninstall()
that stops the service.For example, if an installed service stops automatically (e.g. if the node process exists) no
stop
event is emitted from the node-windows Service. Similarly, starting a stopped service via a service manager does not cause the the node-windows Servicestart
event to be emitted.