code.js
This file
Path
lib/exit/code.js
28 lines · 819 bytes · JavaScript
Last changed by
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
History of this fileTake it
Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 1why, one step back1import {DiscardedError} from '../return/cause.js';Split files (#837)ehmickybefore adoption672c2d7
lines 2–5why, one step back23export const waitForSuccessfulExit = async exitPromise => {4 const [exitCode, signal] = await exitPromise;5Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 6why, one step back6 if (!isSubprocessErrorExit(exitCode, signal) && isFailedExit(exitCode, signal)) {Split files (#837)ehmickybefore adoption672c2d7
lines 7–12why, one step back7 throw new DiscardedError();8 }910 return [exitCode, signal];11};12Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 13why, one step back13export const getSyncExitResult = ({error, status: exitCode, signal}) => ({Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
line 14why, one step back14 resultError: getSyncError(error, exitCode, signal),Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
lines 15–26why, one step back15 exitCode,16 signal,17});1819const getSyncError = (error, exitCode, signal) => {20 if (error !== undefined) {21 return error;22 }2324 return isFailedExit(exitCode, signal) ? new DiscardedError() : undefined;25};26Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 27why, one step back27const isSubprocessErrorExit = (exitCode, signal) => exitCode === undefined && signal === undefined;Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 28why, one step back28const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;