MCPcopy Index your code
hub / github.com/nodejs/node / normalizeSpawnArguments

Function normalizeSpawnArguments

lib/child_process.js:568–753  ·  view source on GitHub ↗
(file, args, options)

Source from the content-addressed store, hash-verified

566
567let emittedDEP0190Already = false;
568function normalizeSpawnArguments(file, args, options) {
569 validateString(file, 'file');
570 validateArgumentNullCheck(file, 'file');
571
572 if (file.length === 0)
573 throw new ERR_INVALID_ARG_VALUE('file', file, 'cannot be empty');
574
575 if (ArrayIsArray(args)) {
576 args = ArrayPrototypeSlice(args);
577 } else if (args == null) {
578 args = [];
579 } else if (typeof args !== 'object') {
580 throw new ERR_INVALID_ARG_TYPE('args', 'object', args);
581 } else {
582 options = args;
583 args = [];
584 }
585
586 validateArgumentsNullCheck(args, 'args');
587
588 if (options === undefined)
589 options = kEmptyObject;
590 else
591 validateObject(options, 'options');
592
593 options = { __proto__: null, ...options };
594 let cwd = options.cwd;
595
596 // Validate the cwd, if present.
597 if (cwd != null) {
598 cwd = getValidatedPath(cwd, 'options.cwd');
599 }
600
601 // Validate detached, if present.
602 if (options.detached != null) {
603 validateBoolean(options.detached, 'options.detached');
604 }
605
606 // Validate the uid, if present.
607 if (options.uid != null) {
608 validateInt32(options.uid, 'options.uid');
609 }
610
611 // Validate the gid, if present.
612 if (options.gid != null) {
613 validateInt32(options.gid, 'options.gid');
614 }
615
616 // Validate the shell, if present.
617 if (options.shell != null &&
618 typeof options.shell !== 'boolean' &&
619 typeof options.shell !== 'string') {
620 throw new ERR_INVALID_ARG_TYPE('options.shell',
621 ['boolean', 'string'], options.shell);
622 }
623
624 // Validate argv0, if present.
625 if (options.argv0 != null) {

Callers 2

spawnFunction · 0.85
spawnSyncFunction · 0.85

Calls 7

copyProcessEnvToEnvFunction · 0.85
isEnabledMethod · 0.80
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…