Skip to content

Commit

Permalink
child_process: name anonymous functions
Browse files Browse the repository at this point in the history
Refs: #8913
PR-URL: #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>
  • Loading branch information
brad-decker authored and Fishrock123 committed Dec 6, 2016
1 parent 573f9db commit fa38032
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ exports._forkChild = function(fd) {
p.open(fd);
p.unref();
const control = setupChannel(process, p);
process.on('newListener', function(name) {
process.on('newListener', function onNewListener(name) {
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();
});
};
Expand Down Expand Up @@ -247,7 +247,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
}

if (options.timeout > 0) {
timeoutId = setTimeout(function() {
timeoutId = setTimeout(function delayedKill() {
kill();
timeoutId = null;
}, options.timeout);
Expand All @@ -257,7 +257,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
if (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;

if (stdoutLen > options.maxBuffer) {
Expand All @@ -276,7 +276,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
if (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;

if (stderrLen > options.maxBuffer) {
Expand All @@ -297,12 +297,14 @@ exports.execFile = function(file /*, args, options, callback*/) {
return child;
};

var _deprecatedCustomFds = internalUtil.deprecate(function(options) {
options.stdio = options.customFds.map(function(fd) {
return fd === -1 ? 'pipe' : fd;
});
}, 'child_process: options.customFds option is deprecated. ' +
'Use options.stdio instead.');
const _deprecatedCustomFds = internalUtil.deprecate(
function deprecateCustomFds(options) {
options.stdio = options.customFds.map(function mapCustomFds(fd) {
return fd === -1 ? 'pipe' : fd;
});
}, 'child_process: options.customFds option is deprecated. ' +
'Use options.stdio instead.'
);

function _convertCustomFds(options) {
if (options.customFds && !options.stdio) {
Expand Down

0 comments on commit fa38032

Please sign in to comment.