code.js
This file
Path
lib/exit/code.js
30 lines · 1.0 KiB · JavaScript
Last changed by
Allow setting different `maxBuffer` values for `stdout`/`stderr` (#966)ehmickybefore adoptionfdffcb6
History of this fileTake it
Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 1why, one step back1import {DiscardedError} from '../return/cause.js';Allow setting different `maxBuffer` values for `stdout`/`stderr` (#966)ehmickybefore adoptionfdffcb6
line 2why, one step back2import {isMaxBufferSync} from '../stream/max-buffer.js';Split files (#837)ehmickybefore adoption672c2d7
lines 3–6why, one step back34export const waitForSuccessfulExit = async exitPromise => {5 const [exitCode, signal] = await exitPromise;6Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 7why, one step back7 if (!isSubprocessErrorExit(exitCode, signal) && isFailedExit(exitCode, signal)) {Split files (#837)ehmickybefore adoption672c2d7
lines 8–13why, one step back8 throw new DiscardedError();9 }1011 return [exitCode, signal];12};13Improve `maxBuffer` option with `execaSync()` (#960)ehmickybefore adoptiondce0393
lines 14–16why, one step back14export const getSyncExitResult = ({error, status: exitCode, signal, output}, {maxBuffer}) => {15 const resultError = getResultError(error, exitCode, signal);16 const timedOut = resultError?.code === 'ETIMEDOUT';Allow setting different `maxBuffer` values for `stdout`/`stderr` (#966)ehmickybefore adoptionfdffcb6
line 17why, one step back17 const isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);Improve `maxBuffer` option with `execaSync()` (#960)ehmickybefore adoptiondce0393
lines 18–19why, one step back18 return {resultError, exitCode, signal, timedOut, isMaxBuffer};19};Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 20why, one step back20Improve `maxBuffer` option with `execaSync()` (#960)ehmickybefore adoptiondce0393
line 21why, one step back21const getResultError = (error, exitCode, signal) => {Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
lines 22–28why, one step back22 if (error !== undefined) {23 return error;24 }2526 return isFailedExit(exitCode, signal) ? new DiscardedError() : undefined;27};28Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
line 29why, one step back29const isSubprocessErrorExit = (exitCode, signal) => exitCode === undefined && signal === undefined;Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815
line 30why, one step back30const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;