mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
fix: preserve child process signal exit codes (#113685)
Co-authored-by: Peter Steinberger <steipete@golden-gate.local>
This commit is contained in:
committed by
GitHub
parent
687923189e
commit
89984a5082
@@ -0,0 +1,12 @@
|
||||
import { constants as osConstants } from "node:os";
|
||||
|
||||
export function resolveSubprocessExitCode(
|
||||
exitCode: number | null | undefined,
|
||||
signal: NodeJS.Signals | null | undefined,
|
||||
): number {
|
||||
if (typeof exitCode === "number") {
|
||||
return exitCode;
|
||||
}
|
||||
const signalNumber = signal ? (osConstants.signals as Record<string, number>)[signal] : undefined;
|
||||
return typeof signalNumber === "number" ? 128 + signalNumber : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user