diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index da38169aac2b4d..4233730a53df88 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -267,11 +267,13 @@ overrides: - ./_stream_*.js - ./_tls_common.js - ./assert/*.js + - ./child_process.js - ./cluster.js - ./console.js - ./constants.js - ./fs.js - ./internal/assert.js + - ./internal/child_process.js - ./internal/child_process/*.js - ./internal/cli_table.js - ./internal/cluster/*.js diff --git a/lib/child_process.js b/lib/child_process.js index 1ee9d56f86c5c0..5d3e2d63a744c2 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -89,7 +89,7 @@ const { getValidStdio, setupChannel, ChildProcess, - stdioStringToArray + stdioStringToArray, } = child_process; const MAX_BUFFER = 1024 * 1024; @@ -200,7 +200,7 @@ function normalizeExecArgs(command, options, callback) { return { file: command, options: options, - callback: callback + callback: callback, }; } @@ -255,7 +255,7 @@ const customPromiseExecFunction = (orig) => { ObjectDefineProperty(exec, promisify.custom, { __proto__: null, enumerable: false, - value: customPromiseExecFunction(exec) + value: customPromiseExecFunction(exec), }); function normalizeExecFileArgs(file, args, options, callback) { @@ -334,7 +334,7 @@ function execFile(file, args, options, callback) { cwd: null, env: null, shell: false, - ...options + ...options, }; // Validate the timeout, if present. @@ -353,7 +353,7 @@ function execFile(file, args, options, callback) { signal: options.signal, uid: options.uid, windowsHide: !!options.windowsHide, - windowsVerbatimArguments: !!options.windowsVerbatimArguments + windowsVerbatimArguments: !!options.windowsVerbatimArguments, }); let encoding; @@ -419,7 +419,7 @@ function execFile(file, args, options, callback) { ex = genericNodeError(`Command failed: ${cmd}\n${stderr}`, { code: code < 0 ? getSystemErrorName(code) : code, killed: child.killed || killed, - signal: signal + signal: signal, }); } @@ -530,7 +530,7 @@ function execFile(file, args, options, callback) { ObjectDefineProperty(execFile, promisify.custom, { __proto__: null, enumerable: false, - value: customPromiseExecFunction(execFile) + value: customPromiseExecFunction(execFile), }); function copyProcessEnvToEnv(env, name, optionEnv) { @@ -827,7 +827,7 @@ function spawn(file, args, options) { function spawnSync(file, args, options) { options = { maxBuffer: MAX_BUFFER, - ...normalizeSpawnArguments(file, args, options) + ...normalizeSpawnArguments(file, args, options), }; debug('spawnSync', options); @@ -1012,5 +1012,5 @@ module.exports = { execSync, fork, spawn, - spawnSync + spawnSync, }; diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 8e2f31a294768c..fc7edbda57d320 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -26,8 +26,8 @@ const { ERR_IPC_DISCONNECTED, ERR_IPC_ONE_PIPE, ERR_IPC_SYNC_FORK, - ERR_MISSING_ARGS - } + ERR_MISSING_ARGS, + }, } = require('internal/errors'); const { validateArray, @@ -47,7 +47,7 @@ const { kReadBytesOrError, kArrayBufferOffset, kLastWriteWasAsync, - streamBaseState + streamBaseState, } = internalBinding('stream_wrap'); const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); const { TCP } = internalBinding('tcp_wrap'); @@ -70,7 +70,7 @@ const { UV_ENFILE, UV_ENOENT, UV_ENOSYS, - UV_ESRCH + UV_ESRCH, } = internalBinding('uv'); const { SocketListSend, SocketListReceive } = SocketList; @@ -97,7 +97,7 @@ const handleConversion = { got(message, handle, emit) { emit(handle); - } + }, }, 'net.Server': { @@ -112,7 +112,7 @@ const handleConversion = { server.listen(handle, () => { emit(server); }); - } + }, }, 'net.Socket': { @@ -186,7 +186,7 @@ const handleConversion = { const socket = new net.Socket({ handle: handle, readable: true, - writable: true + writable: true, }); // If the socket was created by net.Server we will track the socket @@ -195,12 +195,12 @@ const handleConversion = { // Add socket to connections list const socketList = getSocketList('got', this, message.key); socketList.add({ - socket: socket + socket: socket, }); } emit(socket); - } + }, }, 'dgram.Native': { @@ -212,7 +212,7 @@ const handleConversion = { got(message, handle, emit) { emit(handle); - } + }, }, 'dgram.Socket': { @@ -230,8 +230,8 @@ const handleConversion = { socket.bind(handle, () => { emit(socket); }); - } - } + }, + }, }; function stdioStringToArray(stdio, channel) { @@ -587,7 +587,7 @@ function setupChannel(target, channel, serializationMode) { target.channel = val; }, channelDeprecationMsg, 'DEP0129'), configurable: true, - enumerable: false + enumerable: false, }); target._handleQueue = null; @@ -598,7 +598,7 @@ function setupChannel(target, channel, serializationMode) { const { initMessageChannel, parseChannelMessages, - writeChannelMessage + writeChannelMessage, } = serialization[serializationMode]; let pendingHandle = null; @@ -784,7 +784,7 @@ function setupChannel(target, channel, serializationMode) { message = { cmd: 'NODE_HANDLE', type: null, - msg: message + msg: message, }; if (handle instanceof net.Socket) { @@ -1015,7 +1015,7 @@ function getValidStdio(stdio, sync) { const a = { type: stdio === 'overlapped' ? 'overlapped' : 'pipe', readable: i === 0, - writable: i !== 0 + writable: i !== 0, }; if (!sync) @@ -1038,17 +1038,17 @@ function getValidStdio(stdio, sync) { ArrayPrototypePush(acc, { type: 'pipe', handle: ipc, - ipc: true + ipc: true, }); } else if (stdio === 'inherit') { ArrayPrototypePush(acc, { type: 'inherit', - fd: i + fd: i, }); } else if (typeof stdio === 'number' || typeof stdio.fd === 'number') { ArrayPrototypePush(acc, { type: 'fd', - fd: typeof stdio === 'number' ? stdio : stdio.fd + fd: typeof stdio === 'number' ? stdio : stdio.fd, }); } else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) || getHandleWrapType(stdio._handle)) { @@ -1060,7 +1060,7 @@ function getValidStdio(stdio, sync) { type: 'wrap', wrapType: getHandleWrapType(handle), handle: handle, - _stdio: stdio + _stdio: stdio, }); } else if (isArrayBufferView(stdio) || typeof stdio === 'string') { if (!sync) { @@ -1128,5 +1128,5 @@ module.exports = { setupChannel, getValidStdio, stdioStringToArray, - spawnSync + spawnSync, };