Skip to content

Commit b6fcf31

Browse files
committed
child_process: refactor string validation in exec and spawn
1 parent 52c7bb1 commit b6fcf31

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

lib/child_process.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ function _forkChild(fd, serializationMode) {
186186
}
187187

188188
function normalizeExecArgs(command, options, callback) {
189-
validateString(command, 'command');
190-
validateArgumentNullCheck(command, 'command');
191-
192189
if (typeof options === 'function') {
193190
callback = options;
194191
options = undefined;
@@ -538,9 +535,9 @@ function copyProcessEnvToEnv(env, name, optionEnv) {
538535
function normalizeSpawnArguments(file, args, options) {
539536
validateString(file, 'file');
540537
validateArgumentNullCheck(file, 'file');
541-
542-
if (file.length === 0)
543-
throw new ERR_INVALID_ARG_VALUE('file', file, 'cannot be empty');
538+
if (file.length === 0) {
539+
throw new ERR_INVALID_ARG_VALUE(file, 'file', 'cannot be empty');
540+
}
544541

545542
if (ArrayIsArray(args)) {
546543
args = ArrayPrototypeSlice(args);

0 commit comments

Comments
 (0)