Skip to content

Commit

Permalink
Merge pull request helm#863 from adamreese/fix/686-tunnel-error
Browse files Browse the repository at this point in the history
fix(tunnel): display friendly error on connect issues
  • Loading branch information
adamreese authored Jun 22, 2016
2 parents 51b6bca + d300a08 commit 68e0032
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/kube/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ func (c *Client) ForwardPort(namespace, podName string, remote int) (*Tunnel, er
return nil, err
}

errChan := make(chan error)
go func() {
if err := pf.ForwardPorts(); err != nil {
fmt.Printf("Error forwarding ports: %v\n", err)
}
errChan <- pf.ForwardPorts()
}()

// wait for listeners to start
<-pf.Ready

return t, nil
select {
case err = <-errChan:
return t, fmt.Errorf("Error forwarding ports: %v\n", err)
case <-pf.Ready:
return t, nil
}
}

func getAvailablePort() (int, error) {
Expand Down

0 comments on commit 68e0032

Please sign in to comment.