mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-16 07:13:53 +00:00
adds return context in RunPortForward()
This commit is contained in:
parent
8b447d8c97
commit
9e15462843
@ -420,10 +420,13 @@ func (o PortForwardOptions) RunPortForwardContext(ctx context.Context) error {
|
|||||||
signal.Notify(signals, os.Interrupt)
|
signal.Notify(signals, os.Interrupt)
|
||||||
defer signal.Stop(signals)
|
defer signal.Stop(signals)
|
||||||
|
|
||||||
|
returnCtx, returnCtxCancel := context.WithCancel(ctx)
|
||||||
|
defer returnCtxCancel()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-signals:
|
case <-signals:
|
||||||
case <-ctx.Done():
|
case <-returnCtx.Done():
|
||||||
}
|
}
|
||||||
if o.StopChannel != nil {
|
if o.StopChannel != nil {
|
||||||
close(o.StopChannel)
|
close(o.StopChannel)
|
||||||
|
Loading…
Reference in New Issue
Block a user