Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,26 @@ func Execute() {
if err != nil {
//nolint:all
if sshExitErr, ok := err.(*ssh.ExitError); ok {
log.Errorf("SSH command failed with exit code %d", sshExitErr.ExitStatus())
os.Exit(sshExitErr.ExitStatus())
}

//nolint:all
if execExitErr, ok := err.(*exec.ExitError); ok {
log.Errorf("Command failed with exit code %d", execExitErr.ExitCode())
os.Exit(execExitErr.ExitCode())
}

if globalFlags.Debug {
log.Fatalf("%+v", err)
log.Errorf("%+v", err)
} else {
if rootCmd.Annotations == nil ||
rootCmd.Annotations[agent.AgentExecutedAnnotation] != config.BoolTrue {
log.Error("Try using -v or --debug flag to see more verbose output")
}
log.Fatal(err)
log.Errorf("%v", err)
}
os.Exit(1)
}
}

Expand Down
Loading