|
|
@ -208,6 +208,16 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
function errnoException(errorno, syscall) { |
|
|
|
// TODO make this more compatible with ErrnoException from src/node.cc
|
|
|
|
// Once all of Node is using this function the ErrnoException from
|
|
|
|
// src/node.cc should be removed.
|
|
|
|
var e = new Error(syscall + ' ' + errorno); |
|
|
|
e.errno = e.code = errorno; |
|
|
|
e.syscall = syscall; |
|
|
|
return e; |
|
|
|
} |
|
|
|
|
|
|
|
function createWritableStdioStream(fd) { |
|
|
|
var stream; |
|
|
|
var tty_wrap = process.binding('tty_wrap'); |
|
|
@ -318,34 +328,30 @@ |
|
|
|
}; |
|
|
|
|
|
|
|
startup.processKillAndExit = function() { |
|
|
|
var isWindows = process.platform === 'win32'; |
|
|
|
|
|
|
|
process.exit = function(code) { |
|
|
|
process.emit('exit', code || 0); |
|
|
|
process.reallyExit(code || 0); |
|
|
|
}; |
|
|
|
|
|
|
|
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); |
|
|
|
process.kill = function(pid, sig) { |
|
|
|
var r; |
|
|
|
|
|
|
|
// preserve null signal
|
|
|
|
if (0 === sig) { |
|
|
|
r = process._kill(pid, 0); |
|
|
|
} else { |
|
|
|
sig = sig || 'SIGTERM'; |
|
|
|
if (startup.lazyConstants()[sig]) { |
|
|
|
r = process._kill(pid, startup.lazyConstants()[sig]); |
|
|
|
} else { |
|
|
|
sig = sig || 'SIGTERM'; |
|
|
|
if (startup.lazyConstants()[sig]) { |
|
|
|
process._kill(pid, startup.lazyConstants()[sig]); |
|
|
|
} else { |
|
|
|
throw new Error('Unknown signal: ' + sig); |
|
|
|
} |
|
|
|
throw new Error('Unknown signal: ' + sig); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (r) { |
|
|
|
throw errnoException('kill', errno); |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
startup.processSignalHandlers = function() { |
|
|
|