execInNode: check if we have a response before trying to access the reader in case of error to avoid nil pointer exceptions

pull/394/head
iwilltry42 4 years ago
parent 6032be50c0
commit b5eeda74d6
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 2
      pkg/runtimes/docker/node.go

@ -308,7 +308,7 @@ func (d Docker) GetNodeLogs(ctx context.Context, node *k3d.Node, since time.Time
func (d Docker) ExecInNodeGetLogs(ctx context.Context, node *k3d.Node, cmd []string) (*bufio.Reader, error) {
resp, err := executeInNode(ctx, node, cmd)
if err != nil {
if resp.Reader != nil { // sometimes the exec process returns with a non-zero exit code, but we still have the logs we
if resp != nil && resp.Reader != nil { // sometimes the exec process returns with a non-zero exit code, but we still have the logs we
return resp.Reader, err
}
return nil, err

Loading…
Cancel
Save