execInNode: check if we have a response before trying to access the reader in case of error to avoid nil pointer exceptions
This commit is contained in:
parent
6032be50c0
commit
b5eeda74d6
@ -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…
Reference in New Issue
Block a user