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

Function execFileSync

lib/child_process.js:951–968  ·  view source on GitHub ↗

* Spawns a file as a shell synchronously. * @param {string} file * @param {string[]} [args] * @param {{ * cwd?: string | URL; * input?: string | Buffer | TypedArray | DataView; * stdio?: string | Array; * env?: Record ; * uid?: number; * gid?: number; * timeout

(file, args, options)

Source from the content-addressed store, hash-verified

949 * @returns {Buffer | string}
950 */
951function execFileSync(file, args, options) {
952 ({ file, args, options } = normalizeExecFileArgs(file, args, options));
953
954 const inheritStderr = !options.stdio;
955 const ret = spawnSync(file, args, options);
956
957 if (inheritStderr && ret.stderr)
958 process.stderr.write(ret.stderr);
959
960 const errArgs = [options.argv0 || file];
961 ArrayPrototypePushApply(errArgs, args);
962 const err = checkExecSyncError(ret, errArgs);
963
964 if (err)
965 throw err;
966
967 return ret.stdout;
968}
969
970/**
971 * Spawns a shell executing the given `command` synchronously.

Calls 4

normalizeExecFileArgsFunction · 0.85
checkExecSyncErrorFunction · 0.85
spawnSyncFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…