mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 05:46:16 +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)
|
||||
defer signal.Stop(signals)
|
||||
|
||||
returnCtx, returnCtxCancel := context.WithCancel(ctx)
|
||||
defer returnCtxCancel()
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-signals:
|
||||
case <-ctx.Done():
|
||||
case <-returnCtx.Done():
|
||||
}
|
||||
if o.StopChannel != nil {
|
||||
close(o.StopChannel)
|
||||
|
Loading…
Reference in New Issue
Block a user