kirillkovalenko / nssm

Non-Sucking Service Manager
https://nssm.cc
736 stars 126 forks source link

Control-C does not reach my process #1

Closed EugenDueck closed 9 years ago

EugenDueck commented 9 years ago

I've installed a node.exe process as service using nssm 2.24 64-bit, 2014-08-31.

I double-checked via "nssm edit myapp" that

are all checked - which is the default - and all corresponding timeouts are also at their defaults of 1500 ms.

When running my app from a cmd.exe, Ctrl-C gets properly detected inside the app.

When starting the app as an nssm managed service however, my app does not detect a Ctrl-C when I shut down the service. Otherwise, the app works fine. I also redirected stdout/stderr to files, and the few lines myapp prints to stdout properly end up in that file. No other error messages etc. get written to stdout/stderr though, so I have no clue yet as to why the Ctrl-C fails to reach the process.

My node app creates 4 child processes, so ProcExp shows the following tree when the service is up:

Just in case, I also tried to detect Ctrl-C in all those child processes, but it doesn't get there either.

Fwiw, here's the node.js code that listens for Ctrl-C. Started from cmd.exe, Ctrl-C will lead the program to ////////////// 1, while as an nssm service, we don't get there on shutdown.

var readLine = require ("readline");
if (process.platform === "win32"){
    var rl = readLine.createInterface ({
        input: process.stdin,
        output: process.stdout
    });

    rl.on ("SIGINT", function (){
        process.emit ("SIGINT"); ////////////// 1
    });
}

Any way to get to the bottom of this?

EugenDueck commented 9 years ago

Contacted author directly, as this github repo seems to be a mere mirror.

porsager commented 5 years ago

@EugenDueck Did you have luck getting in touch with the author? (tried his email).

I am getting ctrl+c for everything but system shutdowns. (i do get for restarts). Have you solved your issue?