mirror of https://github.com/k3s-io/k3s
client-go PortForwarder: don't log an error if net.Listen fails
parent
cec62c801b
commit
99711a96a4
|
@ -209,8 +209,7 @@ func (pf *PortForwarder) listenOnPortAndAddress(port *ForwardedPort, protocol st
|
||||||
func (pf *PortForwarder) getListener(protocol string, hostname string, port *ForwardedPort) (net.Listener, error) {
|
func (pf *PortForwarder) getListener(protocol string, hostname string, port *ForwardedPort) (net.Listener, error) {
|
||||||
listener, err := net.Listen(protocol, fmt.Sprintf("%s:%d", hostname, port.Local))
|
listener, err := net.Listen(protocol, fmt.Sprintf("%s:%d", hostname, port.Local))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
runtime.HandleError(fmt.Errorf("Unable to create listener: Error %s", err))
|
return nil, fmt.Errorf("Unable to create listener: Error %s", err)
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
listenerAddress := listener.Addr().String()
|
listenerAddress := listener.Addr().String()
|
||||||
host, localPort, _ := net.SplitHostPort(listenerAddress)
|
host, localPort, _ := net.SplitHostPort(listenerAddress)
|
||||||
|
|
Loading…
Reference in New Issue