MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / InterpretCommandResult

Function InterpretCommandResult

tools/bash/semantics.go:98–119  ·  view source on GitHub ↗
(commandLine string, exitCode int)

Source from the content-addressed store, hash-verified

96}
97
98func InterpretCommandResult(commandLine string, exitCode int) ExitCodeInterpretation {
99 if exitCode == 0 {
100 return ExitCodeInterpretation{false, "Success (exit 0)"}
101 }
102
103 base := ResolveBaseCommand(commandLine)
104 if base == "" {
105 return ExitCodeInterpretation{true, fmt.Sprintf("Exit code %d", exitCode)}
106 }
107 table, ok := exitCodeTables[base]
108 if ok && table != nil {
109 specific := table[exitCode]
110 if specific != nil {
111 return *specific
112 }
113 }
114
115 if exitCode < 0 {
116 return ExitCodeInterpretation{true, "Process terminated by a signal or parent context cancellation"}
117 }
118 return ExitCodeInterpretation{true, fmt.Sprintf("Error (exit code %d)", exitCode)}
119}
120
121func FormatExitCode(commandLine string, exitCode int) string {
122 interpretation := InterpretCommandResult(commandLine, exitCode)

Callers 1

FormatExitCodeFunction · 0.85

Calls 1

ResolveBaseCommandFunction · 0.85

Tested by

no test coverage detected