We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6af37bc commit adc0fecCopy full SHA for adc0fec
1 file changed
pkg/portforward/portforward.go
@@ -2,6 +2,7 @@ package portforward
2
3
import (
4
"context"
5
+ "errors"
6
"fmt"
7
"io"
8
"net"
@@ -128,7 +129,6 @@ func NewCommand() *cobra.Command {
128
129
if err != nil {
130
panic(err)
131
}
- defer listener.Close()
132
ctx, cancel := context.WithCancel(context.Background())
133
defer cancel()
134
go func() {
@@ -139,6 +139,9 @@ func NewCommand() *cobra.Command {
139
default:
140
hostConn, err := listener.Accept()
141
142
+ if errors.Is(err, net.ErrClosed) {
143
+ return // Prolly exiting
144
+ }
145
fmt.Printf("Accept error: %v", err)
146
continue
147
0 commit comments