Skip to content
Myr

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 file

Take it

Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815

line 1why, one step back
1import {DiscardedError} from '../return/cause.js';

Split files (#837)ehmickybefore adoption672c2d7

lines 2–5why, one step back
2
3export const waitForSuccessfulExit = async exitPromise => {4 const [exitCode, signal] = await exitPromise;5

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

line 6why, one step back
6 if (!isSubprocessErrorExit(exitCode, signal) && isFailedExit(exitCode, signal)) {

Split files (#837)ehmickybefore adoption672c2d7

lines 7–12why, one step back
7 throw new DiscardedError();
8 }910 return [exitCode, signal];11};12

Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815

line 13why, one step back
13export const getSyncExitResult = ({error, status: exitCode, signal}) => ({

Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09

line 14why, one step back
14 resultError: getSyncError(error, exitCode, signal),

Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815

lines 15–26why, one step back
15 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};26

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

line 27why, one step back
27const isSubprocessErrorExit = (exitCode, signal) => exitCode === undefined && signal === undefined;

Add `ExecaError` and `ExecaSyncError` classes (#911)ehmickybefore adoptionfc01815

line 28why, one step back
28const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;