Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

child_process: add trailing commas in source files #46758

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const {
getValidStdio,
setupChannel,
ChildProcess,
stdioStringToArray
stdioStringToArray,
} = child_process;

const MAX_BUFFER = 1024 * 1024;
Expand Down Expand Up @@ -200,7 +200,7 @@ function normalizeExecArgs(command, options, callback) {
return {
file: command,
options: options,
callback: callback
callback: callback,
};
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -334,7 +334,7 @@ function execFile(file, args, options, callback) {
cwd: null,
env: null,
shell: false,
...options
...options,
};

// Validate the timeout, if present.
Expand All @@ -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;
Expand Down Expand Up @@ -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,
});
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1012,5 +1012,5 @@ module.exports = {
execSync,
fork,
spawn,
spawnSync
spawnSync,
};
42 changes: 21 additions & 21 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
Expand All @@ -70,7 +70,7 @@ const {
UV_ENFILE,
UV_ENOENT,
UV_ENOSYS,
UV_ESRCH
UV_ESRCH,
} = internalBinding('uv');

const { SocketListSend, SocketListReceive } = SocketList;
Expand All @@ -97,7 +97,7 @@ const handleConversion = {

got(message, handle, emit) {
emit(handle);
}
},
},

'net.Server': {
Expand All @@ -112,7 +112,7 @@ const handleConversion = {
server.listen(handle, () => {
emit(server);
});
}
},
},

'net.Socket': {
Expand Down Expand Up @@ -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
Expand All @@ -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': {
Expand All @@ -212,7 +212,7 @@ const handleConversion = {

got(message, handle, emit) {
emit(handle);
}
},
},

'dgram.Socket': {
Expand All @@ -230,8 +230,8 @@ const handleConversion = {
socket.bind(handle, () => {
emit(socket);
});
}
}
},
},
};

function stdioStringToArray(stdio, channel) {
Expand Down Expand Up @@ -587,7 +587,7 @@ function setupChannel(target, channel, serializationMode) {
target.channel = val;
}, channelDeprecationMsg, 'DEP0129'),
configurable: true,
enumerable: false
enumerable: false,
});

target._handleQueue = null;
Expand All @@ -598,7 +598,7 @@ function setupChannel(target, channel, serializationMode) {
const {
initMessageChannel,
parseChannelMessages,
writeChannelMessage
writeChannelMessage,
} = serialization[serializationMode];

let pendingHandle = null;
Expand Down Expand Up @@ -784,7 +784,7 @@ function setupChannel(target, channel, serializationMode) {
message = {
cmd: 'NODE_HANDLE',
type: null,
msg: message
msg: message,
};

if (handle instanceof net.Socket) {
Expand Down Expand Up @@ -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)
Expand All @@ -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)) {
Expand All @@ -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) {
Expand Down Expand Up @@ -1128,5 +1128,5 @@ module.exports = {
setupChannel,
getValidStdio,
stdioStringToArray,
spawnSync
spawnSync,
};