* 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)
| 949 | * @returns {Buffer | string} |
| 950 | */ |
| 951 | function 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. |
no test coverage detected
searching dependent graphs…