coreybutler / coreybutler/node-windows

How to Handle Stopping a Service

Open
#134 2 comments 0 reactions 0 assignees View on GitHub
enhancement question (better for stackoverflow)
Dominant language
JavaScript
Stars
2.9k
Forks
368
PR merge metrics
No merged PRs in 30d

Description

I'm using node-windows and it works great for everything other than stopping and the answer provided in #75 is not what I'm looking for.

If I stop my service using say the Service UI and click "Stop" on my running service, it will shutdown the process but none of my graceful termination code is called. I've tried using the [`death`](https://npmjs.com/package/death) to listen for `SIGINT`, `SIGUP`, `SIGTERM` but no avail (similar to #114). I've also tried listening for the `'stop'` event on my service but that doesn't get fired either, my guess is that it only fires when `svc.stop()` is called from within the app itself.

How can my app know when the service is stopped from outside the current code? What should I be listening for?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.