Skip to content
Myr

exit-sync.js

This file

Path

lib/resolve/exit-sync.js

25 lines · 782 bytes · JavaScript

Last changed by

Add more code comments (#984)ehmickybefore adoptionfdd8a9f

History of this file

Take it

Rename files (#977)ehmickybefore adoption4b2e316

lines 1–4why, one step back
1import {DiscardedError} from '../return/final-error.js';
2import {isMaxBufferSync} from '../io/max-buffer.js';3import {isFailedExit} from './exit-async.js';4

Add more code comments (#984)ehmickybefore adoptionfdd8a9f

line 5why, one step back
5// Retrieve exit code, signal name and error information, with synchronous methods

Rename files (#977)ehmickybefore adoption4b2e316

lines 6–9why, one step back
6export const getExitResultSync = ({error, status: exitCode, signal, output}, {maxBuffer}) => {
7 const resultError = getResultError(error, exitCode, signal);8 const timedOut = resultError?.code === 'ETIMEDOUT';9 const isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);

Upgrade xo (#980)ehmickybefore adoptionccfa412

lines 10–16why, one step back
10 return {
11 resultError,12 exitCode,13 signal,14 timedOut,15 isMaxBuffer,16 };

Rename files (#977)ehmickybefore adoption4b2e316

lines 17–25why, one step back
17};
1819const getResultError = (error, exitCode, signal) => {20 if (error !== undefined) {21 return error;22 }2324 return isFailedExit(exitCode, signal) ? new DiscardedError() : undefined;25};