Lines Matching defs:options
120 * }} [options]
123 function fork(modulePath, args = [], options) {
126 // Get options and args arguments.
132 options = args;
138 if (options != null) {
139 validateObject(options, 'options');
141 options = { __proto__: null, ...options, shell: false };
142 options.execPath = options.execPath || process.execPath;
143 validateArgumentNullCheck(options.execPath, 'options.execPath');
146 execArgv = options.execArgv || process.execArgv;
147 validateArgumentsNullCheck(execArgv, 'options.execArgv');
160 if (typeof options.stdio === 'string') {
161 options.stdio = stdioStringToArray(options.stdio, 'ipc');
162 } else if (!ArrayIsArray(options.stdio)) {
165 options.stdio = stdioStringToArray(
166 options.silent ? 'pipe' : 'inherit',
168 } else if (!ArrayPrototypeIncludes(options.stdio, 'ipc')) {
169 throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
172 return spawn(options.execPath, args, options);
189 function normalizeExecArgs(command, options, callback) {
193 if (typeof options === 'function') {
194 callback = options;
195 options = undefined;
198 // Make a shallow copy so we don't clobber the user's options object.
199 options = { __proto__: null, ...options };
200 options.shell = typeof options.shell === 'string' ? options.shell : true;
204 options: options,
224 * }} [options]
232 function exec(command, options, callback) {
233 const opts = normalizeExecArgs(command, options, callback);
235 opts.options,
263 function normalizeExecFileArgs(file, args, options, callback) {
267 callback = options;
268 options = args;
272 options = null;
280 if (typeof options === 'function') {
281 callback = options;
282 } else if (options != null) {
283 validateObject(options, 'options');
286 if (options == null) {
287 options = kEmptyObject;
295 if (options.argv0 != null) {
296 validateString(options.argv0, 'options.argv0');
297 validateArgumentNullCheck(options.argv0, 'options.argv0');
300 return { file, args, options, callback };
320 * }} [options]
328 function execFile(file, args, options, callback) {
329 ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback));
331 options = {
340 ...options,
344 validateTimeout(options.timeout);
347 validateMaxBuffer(options.maxBuffer);
349 options.killSignal = sanitizeKillSignal(options.killSignal);
352 cwd: options.cwd,
353 env: options.env,
354 gid: options.gid,
355 shell: options.shell,
356 signal: options.signal,
357 uid: options.uid,
358 windowsHide: !!options.windowsHide,
359 windowsVerbatimArguments: !!options.windowsVerbatimArguments,
365 if (options.encoding !== 'buffer' && Buffer.isEncoding(options.encoding)) {
366 encoding = options.encoding;
454 child.kill(options.killSignal);
461 if (options.timeout > 0) {
465 }, options.timeout);
474 if (options.maxBuffer === Infinity) {
486 if (stdoutLen > options.maxBuffer) {
487 const truncatedLen = options.maxBuffer - (stdoutLen - length);
504 if (options.maxBuffer === Infinity) {
514 if (stderrLen > options.maxBuffer) {
515 const truncatedLen = options.maxBuffer - (stderrLen - length);
547 function normalizeSpawnArguments(file, args, options) {
561 options = args;
567 if (options === undefined)
568 options = kEmptyObject;
570 validateObject(options, 'options');
572 let cwd = options.cwd;
576 cwd = getValidatedPath(cwd, 'options.cwd');
580 if (options.detached != null) {
581 validateBoolean(options.detached, 'options.detached');
585 if (options.uid != null && !isInt32(options.uid)) {
586 throw new ERR_INVALID_ARG_TYPE('options.uid', 'int32', options.uid);
590 if (options.gid != null && !isInt32(options.gid)) {
591 throw new ERR_INVALID_ARG_TYPE('options.gid', 'int32', options.gid);
595 if (options.shell != null &&
596 typeof options.shell !== 'boolean' &&
597 typeof options.shell !== 'string') {
598 throw new ERR_INVALID_ARG_TYPE('options.shell',
599 ['boolean', 'string'], options.shell);
603 if (options.argv0 != null) {
604 validateString(options.argv0, 'options.argv0');
605 validateArgumentNullCheck(options.argv0, 'options.argv0');
609 if (options.windowsHide != null) {
610 validateBoolean(options.windowsHide, 'options.windowsHide');
614 let { windowsVerbatimArguments } = options;
617 'options.windowsVerbatimArguments');
620 if (options.shell) {
621 validateArgumentNullCheck(options.shell, 'options.shell');
625 if (typeof options.shell === 'string')
626 file = options.shell;
637 if (typeof options.shell === 'string')
638 file = options.shell;
647 if (typeof options.argv0 === 'string') {
648 ArrayPrototypeUnshift(args, options.argv0);
653 const env = options.env || process.env;
658 copyProcessEnvToEnv(env, 'NODE_V8_COVERAGE', options.env);
662 copyProcessEnvToEnv(env, '_BPXK_AUTOCVT', options.env);
663 copyProcessEnvToEnv(env, '_CEE_RUNOPTS', options.env);
664 copyProcessEnvToEnv(env, '_TAG_REDIR_ERR', options.env);
665 copyProcessEnvToEnv(env, '_TAG_REDIR_IN', options.env);
666 copyProcessEnvToEnv(env, '_TAG_REDIR_OUT', options.env);
667 copyProcessEnvToEnv(env, 'STEPLIB', options.env);
668 copyProcessEnvToEnv(env, 'LIBPATH', options.env);
669 copyProcessEnvToEnv(env, '_EDC_SIG_DFLT', options.env);
670 copyProcessEnvToEnv(env, '_EDC_SUSV3', options.env);
699 validateArgumentNullCheck(key, `options.env['${key}']`);
700 validateArgumentNullCheck(value, `options.env['${key}']`);
706 // Make a shallow copy so we don't clobber the user's options object.
708 ...options,
711 detached: !!options.detached,
714 windowsHide: !!options.windowsHide,
750 * }} [options]
753 function spawn(file, args, options) {
754 options = normalizeSpawnArguments(file, args, options);
755 validateTimeout(options.timeout);
756 validateAbortSignal(options.signal, 'options.signal');
757 const killSignal = sanitizeKillSignal(options.killSignal);
760 debug('spawn', options);
761 child.spawn(options);
763 if (options.timeout > 0) {
773 }, options.timeout);
783 if (options.signal) {
784 const signal = options.signal;
794 abortChildProcess(child, killSignal, options.signal.reason);
820 * }} [options]
831 function spawnSync(file, args, options) {
832 options = {
835 ...normalizeSpawnArguments(file, args, options),
838 debug('spawnSync', options);
841 validateTimeout(options.timeout);
844 validateMaxBuffer(options.maxBuffer);
847 options.killSignal = sanitizeKillSignal(options.killSignal);
849 options.stdio = getValidStdio(options.stdio || 'pipe', true).stdio;
851 if (options.input) {
852 const stdin = options.stdio[0] = { ...options.stdio[0] };
853 stdin.input = options.input;
857 for (let i = 0; i < options.stdio.length; i++) {
858 const input = options.stdio[i] && options.stdio[i].input;
860 const pipe = options.stdio[i] = { ...options.stdio[i] };
864 pipe.input = Buffer.from(input, options.encoding);
866 throw new ERR_INVALID_ARG_TYPE(`options.stdio[${i}]`,
876 return child_process.spawnSync(options);
912 * }} [options]
915 function execFileSync(file, args, options) {
916 ({ file, args, options } = normalizeExecFileArgs(file, args, options));
918 const inheritStderr = !options.stdio;
919 const ret = spawnSync(file, args, options);
924 const errArgs = [options.argv0 || file];
950 * }} [options]
953 function execSync(command, options) {
954 const opts = normalizeExecArgs(command, options, null);
955 const inheritStderr = !opts.options.stdio;
957 const ret = spawnSync(opts.file, opts.options);
994 throw new ERR_OUT_OF_RANGE('options.maxBuffer',
1005 throw new ERR_INVALID_ARG_TYPE('options.killSignal',