MCPcopy
hub / github.com/wavetermdev/waveterm / GetCmdExitCode

Function GetCmdExitCode

pkg/util/utilfn/utilfn.go:682–697  ·  view source on GitHub ↗
(cmd *exec.Cmd, err error)

Source from the content-addressed store, hash-verified

680}
681
682func GetCmdExitCode(cmd *exec.Cmd, err error) int {
683 if cmd == nil || cmd.ProcessState == nil {
684 return GetExitCode(err)
685 }
686 status, ok := cmd.ProcessState.Sys().(syscall.WaitStatus)
687 if !ok {
688 return cmd.ProcessState.ExitCode()
689 }
690 signaled := status.Signaled()
691 if signaled {
692 signal := status.Signal()
693 return 128 + int(signal)
694 }
695 exitStatus := status.ExitStatus()
696 return exitStatus
697}
698
699func GetExitCode(err error) int {
700 if err == nil {

Callers

nothing calls this directly

Calls 3

GetExitCodeFunction · 0.85
SysMethod · 0.80
ExitCodeMethod · 0.65

Tested by

no test coverage detected