17 lines
421 B
JavaScript
17 lines
421 B
JavaScript
export function handleUnexpectedChildExit({
|
|
label,
|
|
code,
|
|
signal,
|
|
stopping,
|
|
shutdown,
|
|
log = console.error,
|
|
}) {
|
|
if (stopping) return false;
|
|
|
|
const detail = signal ? `signal ${signal}` : `code ${code ?? 'unknown'}`;
|
|
const shutdownCode = Number.isInteger(code) && code > 0 ? code : 1;
|
|
log(`[${label}] exited unexpectedly (${detail}); shutting down dev stack`);
|
|
shutdown(shutdownCode);
|
|
return true;
|
|
}
|