From 535311097c28295c5fa785d5fcde57443c51229e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 24 Feb 2023 09:44:18 +0100 Subject: [PATCH] child_process: add trailing commas in source files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/46758 Reviewed-By: Deokjin Kim Reviewed-By: Michaƫl Zasso Reviewed-By: Moshe Atlow Reviewed-By: James M Snell --- lib/.eslintrc.yaml | 2 ++ lib/child_process.js | 18 +++++++-------- lib/internal/child_process.js | 42 +++++++++++++++++------------------ 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index de55a7e91b0577..93f602681bc286 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -255,11 +255,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 0a50c57b737b17..b0ea6e009e10e5 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'); @@ -68,7 +68,7 @@ const { UV_ENFILE, UV_ENOENT, UV_ENOSYS, - UV_ESRCH + UV_ESRCH, } = internalBinding('uv'); const { SocketListSend, SocketListReceive } = SocketList; @@ -95,7 +95,7 @@ const handleConversion = { got(message, handle, emit) { emit(handle); - } + }, }, 'net.Server': { @@ -110,7 +110,7 @@ const handleConversion = { server.listen(handle, () => { emit(server); }); - } + }, }, 'net.Socket': { @@ -184,7 +184,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 @@ -193,12 +193,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': { @@ -210,7 +210,7 @@ const handleConversion = { got(message, handle, emit) { emit(handle); - } + }, }, 'dgram.Socket': { @@ -228,8 +228,8 @@ const handleConversion = { socket.bind(handle, () => { emit(socket); }); - } - } + }, + }, }; function stdioStringToArray(stdio, channel) { @@ -580,7 +580,7 @@ function setupChannel(target, channel, serializationMode) { target.channel = val; }, channelDeprecationMsg, 'DEP0129'), configurable: true, - enumerable: false + enumerable: false, }); target._handleQueue = null; @@ -591,7 +591,7 @@ function setupChannel(target, channel, serializationMode) { const { initMessageChannel, parseChannelMessages, - writeChannelMessage + writeChannelMessage, } = serialization[serializationMode]; let pendingHandle = null; @@ -777,7 +777,7 @@ function setupChannel(target, channel, serializationMode) { message = { cmd: 'NODE_HANDLE', type: null, - msg: message + msg: message, }; if (handle instanceof net.Socket) { @@ -1008,7 +1008,7 @@ function getValidStdio(stdio, sync) { const a = { type: stdio === 'overlapped' ? 'overlapped' : 'pipe', readable: i === 0, - writable: i !== 0 + writable: i !== 0, }; if (!sync) @@ -1031,17 +1031,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)) { @@ -1053,7 +1053,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) { @@ -1121,5 +1121,5 @@ module.exports = { setupChannel, getValidStdio, stdioStringToArray, - spawnSync + spawnSync, };