mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
make process.kill a no-op on windows
This commit is contained in:
1 parent
fafb584881
commit
69b73f9cf0
2 files changed
+26
-14
No files matched your search
+22
-12
@@ -321,24 +321,34 @@
|
||||
};
|
||||
|
||||
startup.processKillAndExit = function() {
|
||||
var isWindows = process.platform === 'win32';
|
||||
|
||||
process.exit = function(code) {
|
||||
process.emit('exit', code || 0);
|
||||
process.reallyExit(code || 0);
|
||||
};
|
||||
|
||||
process.kill = function(pid, sig) {
|
||||
// preserve null signal
|
||||
if (0 === sig) {
|
||||
process._kill(pid, 0);
|
||||
} else {
|
||||
sig = sig || 'SIGTERM';
|
||||
if (startup.lazyConstants()[sig]) {
|
||||
process._kill(pid, startup.lazyConstants()[sig]);
|
||||
} else {
|
||||
throw new Error('Unknown signal: ' + sig);
|
||||
}
|
||||
if (isWindows) {
|
||||
process.kill = function(pid, sig) {
|
||||
console.warn('process.kill() is not supported on Windows. Use ' +
|
||||
'child.kill() to kill a process that was started ' +
|
||||
'with child_process.spawn().');
|
||||
}
|
||||
};
|
||||
} else {
|
||||
process.kill = function(pid, sig) {
|
||||
// preserve null signal
|
||||
if (0 === sig) {
|
||||
process._kill(pid, 0);
|
||||
} else {
|
||||
sig = sig || 'SIGTERM';
|
||||
if (startup.lazyConstants()[sig]) {
|
||||
process._kill(pid, startup.lazyConstants()[sig]);
|
||||
} else {
|
||||
throw new Error('Unknown signal: ' + sig);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
startup.processSignalHandlers = function() {
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// libuv-broken
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
console.warn('Skipping because process.kill is not supported on windows');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
Reference in new issue
Block a user