(file, args, options)
| 66868 | if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) { |
| 66869 | return error === void 0 ? void 0 : ""; |
| 66870 | } |
| 66871 | if (options.stripFinalNewline) { |
| 66872 | return stripFinalNewline(value); |
| 66873 | } |
| 66874 | return value; |
| 66875 | }; |
| 66876 | function execa(file, args, options) { |
| 66877 | const parsed = handleArguments(file, args, options); |
| 66878 | const command = joinCommand(file, args); |
| 66879 | const escapedCommand = getEscapedCommand(file, args); |
| 66880 | logCommand(escapedCommand, parsed.options); |
| 66881 | validateTimeout(parsed.options); |
| 66882 | let spawned; |
| 66883 | try { |
| 66884 | spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options); |
| 66885 | } catch (error) { |
| 66886 | const dummySpawned = new import_node_child_process3.default.ChildProcess(); |
| 66887 | const errorPromise = Promise.reject(makeError({ |
| 66888 | error, |
| 66889 | stdout: "", |
| 66890 | stderr: "", |
| 66891 | all: "", |
| 66892 | command, |
| 66893 | escapedCommand, |
| 66894 | parsed, |
| 66895 | timedOut: false, |
| 66896 | isCanceled: false, |
| 66897 | killed: false |
| 66898 | })); |
| 66899 | mergePromise(dummySpawned, errorPromise); |
| 66900 | return dummySpawned; |
| 66901 | } |
| 66902 | const spawnedPromise = getSpawnedPromise(spawned); |
| 66903 | const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise); |
| 66904 | const processDone = setExitHandler(spawned, parsed.options, timedPromise); |
| 66905 | const context = { isCanceled: false }; |
| 66906 | spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned)); |
| 66907 | spawned.cancel = spawnedCancel.bind(null, spawned, context); |
| 66908 | const handlePromise = async () => { |
| 66909 | const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone); |
| 66910 | const stdout = handleOutput(parsed.options, stdoutResult); |
| 66911 | const stderr2 = handleOutput(parsed.options, stderrResult); |
| 66912 | const all3 = handleOutput(parsed.options, allResult); |
| 66913 | if (error || exitCode !== 0 || signal !== null) { |
| 66914 | const returnedError = makeError({ |
| 66915 | error, |
| 66916 | exitCode, |
| 66917 | signal, |
| 66918 | stdout, |
| 66919 | stderr: stderr2, |
| 66920 | all: all3, |
| 66921 | command, |
| 66922 | escapedCommand, |
| 66923 | parsed, |
| 66924 | timedOut, |
| 66925 | isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false), |
| 66926 | killed: spawned.killed |
| 66927 | }); |
no test coverage detected
searching dependent graphs…