add error message to failing commands *facepalm*

This commit is contained in:
Shane C 2024-09-19 10:53:21 -04:00
parent 8c22105cf2
commit 88c55d3d73
Signed by: shane
GPG key ID: E46B5FEA35B22FF9
2 changed files with 3 additions and 0 deletions

View file

@ -14,4 +14,5 @@ type EventExitData struct {
HasSucceeded bool
ExitCode int
CmdOptions CommandOptions
Error string
}

View file

@ -192,6 +192,7 @@ func (cmd *LinuxCommand) Run() error {
}
exitInfo.HasSucceeded = false
exitInfo.ExitCode = exitErr.ExitCode()
exitInfo.Error = exitErr.Error()
err := h.(func(data EventExitData) error)(*exitInfo)
if err != nil {
return fmt.Errorf("%s: %w", ErrRunningEvt.Error(), err)
@ -205,6 +206,7 @@ func (cmd *LinuxCommand) Run() error {
}
exitInfo.HasSucceeded = false
exitInfo.ExitCode = exitErr.ExitCode()
exitInfo.Error = exitErr.Error()
err := h.(func(data EventExitData) error)(*exitInfo)
if err != nil {
return fmt.Errorf("%s: %w", ErrRunningEvt.Error(), err)