Skip to content

Commit fdd7ef5

Browse files
committed
Update README
1 parent b93f6bc commit fdd7ef5

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# node-windows-kill
22
[![Build Status](https://travis-ci.org/alirdn/node-windows-kill.svg?branch=master)](https://travis-ci.org/alirdn/node-windows-kill) [![Build status](https://ci.appveyor.com/api/projects/status/ckerpyyjyuxyoija?svg=true)](https://ci.appveyor.com/project/alirdn/node-windows-kill) [![codecov](https://codecov.io/gh/alirdn/node-windows-kill/branch/master/graph/badge.svg?)](https://codecov.io/gh/alirdn/node-windows-kill)
33

4-
Enhance node's process.kill to support signals in Windows
4+
Enhance node's ```process.kill``` to support signals in Windows
55

66
## Installation
77
```
@@ -11,20 +11,29 @@ $ npm install windows-kill
1111
## Features
1212
* No code change is needed. Just old ```process.kill``` calls.
1313
* Support Both x86 & x64 Windows
14-
* No effect on ***Non Windows*** operation systems (Linux, Mac OS X, ...)
14+
* No effect on ***Non Windows*** operation systems (Linux, Mac OS X, etc...)
1515
* Support both ```SIGINT``` and ```SIGBREAK``` (Just the two signals that are available on Windows)
1616

1717
## Why windows-kill?
18-
Sending signal to another process, just by knowing it's PID, is not availabe at Windows OS. It's a UNIX-like feature. But, sending signal to other process, for telling it that something is going to happen to you, is a way to give other process some time for gracefull shutdown/restart. windows-kill tries to fix this issue by bringing the ability to send signals, ```SIGINT``` and ```SIGBREAK```, to another process by PID.
18+
Sending signal to another process, just by knowing it's PID, is not available at Windows OS. It's a POSIX OSes feature. But, sending signal to other process, for telling it that something is going to happen to you, is a way to give other process some time for graceful shutdown/restart. windows-kill tries to fix this issue by bringing the ability to send signals, ```SIGINT``` and ```SIGBREAK```, to another process by **PID**.
19+
20+
## How it works?
21+
To read a detailed info please visit [windows-kill-library Readme](https://github.com/alirdn/windows-kill/tree/master/windows-kill-library#how-it-works).
22+
23+
### Limitations
24+
To send the signal, **windows-kill** at first send a same signal to the process that is calling it, to find a thread address. Then the founded address is used to send the real signal. Because of this, the process that is sending the signal will get the same signal too. But windows-kill register a signal handle during this procedure, so the process will not terminate. But if the process that is sending signal has child process, or is a child process of another process, sending signal will trigger the signal handles in other process in the same process group. And the default behavior of Windows console/application in case of getting a ```SIGINT``` or ```SIGBREAK```, is to terminate.
25+
To **sum up**, If you are sending signal in node app that has child process (any kind of it), or is a child process of another process, the result is the termination of all the processes in the same process group, except the sender (well if it's a child process, because the master is terminated, it will terminate too).
26+
27+
**PS**: Currently there is no solution for this problem. But I'm working on it, to find a solution.
1928

2029
## Usage
2130
```windows-kill``` expose a function. Simply run the exposed function with/without the options. Thats it. It should be called before any usage of ```process.kill```.
2231

23-
By default, ```windows-kill``` will enhance the node's process.kill in a way, that no code changes are needed in your codebase. Ehnance means that ```windows-kill``` will replace the node's ```process.kill``` with a custom function with the same arguments and behaviour. Just some changes to acheive signaling in Windows.
32+
By default, ```windows-kill``` will enhance the node's process.kill in a way, that no code changes are needed in your codebase. Enhance means that ```windows-kill``` will replace the node's ```process.kill``` with a custom function with the same arguments and functionality. Just some changes to achieve signaling in Windows.
2433

2534
### Simplest usage
2635
```javascript
27-
require('windows-kill')();
36+
var windowsKill = require('windows-kill')();
2837

2938
process.kill(PID, SIGNAL);
3039
```

0 commit comments

Comments
 (0)