mirror of https://github.com/openclaw/openclaw.git
fix: narrow exec exit failure kind typing
This commit is contained in:
parent
dd860e76aa
commit
dc6c22b812
|
|
@ -153,6 +153,8 @@ export type ExecProcessFailureKind =
|
|||
| "aborted"
|
||||
| "runtime-error";
|
||||
|
||||
type ExecExitFailureKind = Exclude<ExecProcessFailureKind, "runtime-error">;
|
||||
|
||||
export type ExecProcessOutcome =
|
||||
| {
|
||||
status: "completed";
|
||||
|
|
@ -315,7 +317,7 @@ function classifyExecFailureKind(params: {
|
|||
exitCode: number;
|
||||
isShellFailure: boolean;
|
||||
exitSignal: NodeJS.Signals | number | null;
|
||||
}): ExecProcessFailureKind {
|
||||
}): ExecExitFailureKind {
|
||||
if (params.isShellFailure) {
|
||||
return params.exitCode === 127 ? "shell-command-not-found" : "shell-not-executable";
|
||||
}
|
||||
|
|
@ -332,13 +334,11 @@ function classifyExecFailureKind(params: {
|
|||
}
|
||||
|
||||
export function formatExecFailureReason(params: {
|
||||
failureKind: ExecProcessFailureKind;
|
||||
failureKind: ExecExitFailureKind;
|
||||
exitSignal: NodeJS.Signals | number | null;
|
||||
timeoutSec: number | null | undefined;
|
||||
}): string {
|
||||
switch (params.failureKind) {
|
||||
case "runtime-error":
|
||||
return "Command failed before exit status was captured";
|
||||
case "shell-command-not-found":
|
||||
return "Command not found";
|
||||
case "shell-not-executable":
|
||||
|
|
|
|||
Loading…
Reference in New Issue