Skip to content

Commit fa38032

Browse files
brad-deckerFishrock123
authored andcommitted
child_process: name anonymous functions
Refs: #8913 PR-URL: #9880 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Brian White <[email protected]>
1 parent 573f9db commit fa38032

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lib/child_process.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ exports._forkChild = function(fd) {
7070
p.open(fd);
7171
p.unref();
7272
const control = setupChannel(process, p);
73-
process.on('newListener', function(name) {
73+
process.on('newListener', function onNewListener(name) {
7474
if (name === 'message' || name === 'disconnect') control.ref();
7575
});
76-
process.on('removeListener', function(name) {
76+
process.on('removeListener', function onRemoveListener(name) {
7777
if (name === 'message' || name === 'disconnect') control.unref();
7878
});
7979
};
@@ -247,7 +247,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
247247
}
248248

249249
if (options.timeout > 0) {
250-
timeoutId = setTimeout(function() {
250+
timeoutId = setTimeout(function delayedKill() {
251251
kill();
252252
timeoutId = null;
253253
}, options.timeout);
@@ -257,7 +257,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
257257
if (encoding)
258258
child.stdout.setEncoding(encoding);
259259

260-
child.stdout.addListener('data', function(chunk) {
260+
child.stdout.on('data', function onChildStdout(chunk) {
261261
stdoutLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length;
262262

263263
if (stdoutLen > options.maxBuffer) {
@@ -276,7 +276,7 @@ exports.execFile = function(file /*, args, options, callback*/) {
276276
if (encoding)
277277
child.stderr.setEncoding(encoding);
278278

279-
child.stderr.addListener('data', function(chunk) {
279+
child.stderr.on('data', function onChildStderr(chunk) {
280280
stderrLen += encoding ? Buffer.byteLength(chunk, encoding) : chunk.length;
281281

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

300-
var _deprecatedCustomFds = internalUtil.deprecate(function(options) {
301-
options.stdio = options.customFds.map(function(fd) {
302-
return fd === -1 ? 'pipe' : fd;
303-
});
304-
}, 'child_process: options.customFds option is deprecated. ' +
305-
'Use options.stdio instead.');
300+
const _deprecatedCustomFds = internalUtil.deprecate(
301+
function deprecateCustomFds(options) {
302+
options.stdio = options.customFds.map(function mapCustomFds(fd) {
303+
return fd === -1 ? 'pipe' : fd;
304+
});
305+
}, 'child_process: options.customFds option is deprecated. ' +
306+
'Use options.stdio instead.'
307+
);
306308

307309
function _convertCustomFds(options) {
308310
if (options.customFds && !options.stdio) {

0 commit comments

Comments
 (0)