Skip to content

Commit

Permalink
Implement 'aws_ssm' connection type #26
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-przybyl-wttech committed Jan 25, 2024
1 parent 8669a9f commit e41d5d6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/client/connection_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ func (s *SSHConnection) Command(cmdLine []string) ([]byte, error) {
return nil, fmt.Errorf("ssh: cannot create command '%s' for host '%s': %w", strings.Join(cmdLine, " "), s.host, err)
}
out, err := cmd.CombinedOutput()
if err != nil {
if len(out) > 0 {
return nil, fmt.Errorf("ssh: cannot run command '%s': %w\n\n%s", cmd, err, string(out))
}
return nil, err
if err != nil && len(out) > 0 {
return nil, fmt.Errorf("ssh: cannot run command '%s': %w\n\n%s", cmd, err, string(out))
} else if err != nil {
return nil, fmt.Errorf("ssh: cannot run command '%s': %w", cmd, err)
}
return out, nil
}
Expand Down

0 comments on commit e41d5d6

Please sign in to comment.