Browse Source

child_process: name anonymous functions

Refs: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/9880
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
v6
brad-decker 8 years ago
committed by James M Snell
parent
commit
bbed075325
  1. 24
      lib/child_process.js

24
lib/child_process.js

@ -70,10 +70,10 @@ exports._forkChild = function(fd) {
p.open(fd); p.open(fd);
p.unref(); p.unref();
const control = setupChannel(process, p); const control = setupChannel(process, p);
process.on('newListener', function(name) { process.on('newListener', function onNewListener(name) {
if (name === 'message' || name === 'disconnect') control.ref(); if (name === 'message' || name === 'disconnect') control.ref();
}); });
process.on('removeListener', function(name) { process.on('removeListener', function onRemoveListener(name) {
if (name === 'message' || name === 'disconnect') control.unref(); if (name === 'message' || name === 'disconnect') control.unref();
}); });
}; };
@ -247,7 +247,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
} }
if (options.timeout > 0) { if (options.timeout > 0) {
timeoutId = setTimeout(function() { timeoutId = setTimeout(function delayedKill() {
kill(); kill();
timeoutId = null; timeoutId = null;
}, options.timeout); }, options.timeout);
@ -257,7 +257,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
if (encoding) if (encoding)
child.stdout.setEncoding(encoding); child.stdout.setEncoding(encoding);
child.stdout.addListener('data', function(chunk) { child.stdout.on('data', function onChildStdout(chunk) {
stdoutLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length; stdoutLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length;
if (stdoutLen > options.maxBuffer) { if (stdoutLen > options.maxBuffer) {
@ -276,7 +276,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
if (encoding) if (encoding)
child.stderr.setEncoding(encoding); child.stderr.setEncoding(encoding);
child.stderr.addListener('data', function(chunk) { child.stderr.on('data', function onChildStderr(chunk) {
stderrLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length; stderrLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length;
if (stderrLen > options.maxBuffer) { if (stderrLen > options.maxBuffer) {
@ -297,12 +297,14 @@ exports.execFile = function(file /*, args, options, callback*/) {
return child; return child;
}; };
var _deprecatedCustomFds = internalUtil.deprecate(function(options) { const _deprecatedCustomFds = internalUtil.deprecate(
options.stdio = options.customFds.map(function(fd) { function deprecateCustomFds(options) {
return fd === -1 ? 'pipe' : fd; options.stdio = options.customFds.map(function mapCustomFds(fd) {
}); return fd === -1 ? 'pipe' : fd;
}, 'child_process: options.customFds option is deprecated. ' + });
'Use options.stdio instead.'); }, 'child_process: options.customFds option is deprecated. ' +
'Use options.stdio instead.'
);
function _convertCustomFds(options) { function _convertCustomFds(options) {
if (options.customFds && !options.stdio) { if (options.customFds && !options.stdio) {

Loading…
Cancel
Save