MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / formatExitStatus

Function formatExitStatus

src/core/tools/ExecuteCommandTool.ts:569–592  ·  view source on GitHub ↗

* Format exit status from ExitCodeDetails

(exitDetails: ExitCodeDetails | undefined)

Source from the content-addressed store, hash-verified

567 * Format exit status from ExitCodeDetails
568 */
569function formatExitStatus(exitDetails: ExitCodeDetails | undefined): string {
570 if (exitDetails === undefined) {
571 return "Exit code: <undefined, notify user>"
572 }
573
574 if (exitDetails.signalName) {
575 let status = `Process terminated by signal ${exitDetails.signalName}`
576 if (exitDetails.coreDumpPossible) {
577 status += " - core dump possible"
578 }
579 return status
580 }
581
582 if (exitDetails.exitCode === undefined) {
583 return "Exit code: <undefined, notify user>"
584 }
585
586 let status = ""
587 if (exitDetails.exitCode !== 0) {
588 status += "Command execution was not successful, inspect the cause and adjust as needed.\n"
589 }
590 status += `Exit code: ${exitDetails.exitCode}`
591 return status
592}
593
594/**
595 * Format persisted output result for tool response when output was truncated

Callers 2

executeCommandInTerminalFunction · 0.85
formatPersistedOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected