pkrumins / node-tree-kill

kill trees of processes
MIT License
333 stars 37 forks source link

Uncaught Error: kill ESRCH #16

Closed 0o-de-lally closed 7 years ago

0o-de-lally commented 7 years ago

On node 4.6 I'm getting: Uncaught Error: kill ESRCH . This means the pid does not exist. However I am checking to see if the process exists before killing it:

           if( process.kill( pid, 0) ){ //checks if the pid exists
             kill( pid )
           }

This only happens when I'm starting and killing processes back to back in a test runner.

Any clues on what might cause this?

billiegoose commented 7 years ago

What operating system are you on? I think sending signals other than SIGTERM is OS dependent. (Definitely doesn't work on Windows...)

0o-de-lally commented 7 years ago

I think we can close this, in the mean time I discovered that my test runner was doing some unexpected async calls. One thing could be clarified in the docs. Do the callback run every time or only on error?

billiegoose commented 7 years ago

Run every time. Only pass an argument if there's an error.