mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
fix: narrow exec exit failure kind typing
This commit is contained in:
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user