fix(dev): stop stale frontend when portal exits

This commit is contained in:
john
2026-07-27 10:28:12 +08:00
parent 6b479c16f9
commit c88623855f
5 changed files with 85 additions and 6 deletions
+16
View File
@@ -0,0 +1,16 @@
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;
}