Browse Source

child_process: rename field _internal to _handle

Consistent with how other classes that are built around HandleWraps call it.
v0.9.1-release
Ben Noordhuis 13 years ago
parent
commit
4ec77e2e28
  1. 20
      lib/child_process.js
  2. 2
      test/simple/test-child-process-kill-throw.js

20
lib/child_process.js

@ -627,8 +627,8 @@ function ChildProcess() {
this.exitCode = null; this.exitCode = null;
this.killed = false; this.killed = false;
this._internal = new Process(); this._handle = new Process();
this._internal.onexit = function(exitCode, signalCode) { this._handle.onexit = function(exitCode, signalCode) {
// //
// follow 0.4.x behaviour: // follow 0.4.x behaviour:
// //
@ -645,8 +645,8 @@ function ChildProcess() {
self.stdin.destroy(); self.stdin.destroy();
} }
self._internal.close(); self._handle.close();
self._internal = null; self._handle = null;
self.emit('exit', self.exitCode, self.signalCode); self.emit('exit', self.exitCode, self.signalCode);
@ -681,7 +681,7 @@ ChildProcess.prototype.spawn = function(options) {
setStreamOption('stdoutStream', 1, options); setStreamOption('stdoutStream', 1, options);
setStreamOption('stderrStream', 2, options); setStreamOption('stderrStream', 2, options);
var r = this._internal.spawn(options); var r = this._handle.spawn(options);
if (r) { if (r) {
if (options.stdinStream) { if (options.stdinStream) {
@ -696,12 +696,12 @@ ChildProcess.prototype.spawn = function(options) {
options.stderrStream.close(); options.stderrStream.close();
} }
this._internal.close(); this._handle.close();
this._internal = null; this._handle = null;
throw errnoException(errno, 'spawn'); throw errnoException(errno, 'spawn');
} }
this.pid = this._internal.pid; this.pid = this._handle.pid;
if (options.stdinStream) { if (options.stdinStream) {
this.stdin = createSocket(options.stdinStream, false); this.stdin = createSocket(options.stdinStream, false);
@ -754,9 +754,9 @@ ChildProcess.prototype.kill = function(sig) {
throw new Error('Unknown signal: ' + sig); throw new Error('Unknown signal: ' + sig);
} }
if (this._internal) { if (this._handle) {
this.killed = true; this.killed = true;
var r = this._internal.kill(signal); var r = this._handle.kill(signal);
if (r === -1) { if (r === -1) {
this.emit('error', errnoException(errno, 'kill')); this.emit('error', errnoException(errno, 'kill'));
return; return;

2
test/simple/test-child-process-kill-throw.js

@ -30,7 +30,7 @@ if (process.argv[2] === 'child') {
var error = {}; var error = {};
child.on('exit', function() { child.on('exit', function() {
child._internal = { child._handle = {
kill: function() { kill: function() {
global.errno = 42; global.errno = 42;
return -1; return -1;

Loading…
Cancel
Save