MCPcopy Create free account
hub / github.com/6pac/SlickGrid / getExitCode

Function getExitCode

scripts/child-process.mjs:179–193  ·  view source on GitHub ↗

* Return the exitCode when possible or else throw an error * @param {*} result * @returns

(result)

Source from the content-addressed store, hash-verified

177 * @returns
178 */
179function getExitCode(result) {
180 // https://nodejs.org/docs/latest-v6.x/api/child_process.html#child_process_event_close
181 if (typeof result.code === 'number' || typeof result.exitCode === 'number') {
182 return result.code ?? result.exitCode;
183 }
184
185 // https://nodejs.org/docs/latest-v6.x/api/errors.html#errors_error_code
186 // istanbul ignore else
187 if (typeof result.code === 'string' || typeof result.exitCode === 'string') {
188 return os.constants.errno[result.code ?? result.exitCode];
189 }
190
191 // istanbul ignore next: extremely weird
192 throw new Error(`Received unexpected exit code value ${JSON.stringify(result.code ?? result.exitCode)}`);
193}
194
195/**
196 * Spawn a command asynchronously, _always_ inheriting stdio.

Callers 1

wrapErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected