adds return context in RunPortForward()
Kubernetes-commit: 9e1546284302c66fda0bae12fc301ee8acf39933
This commit is contained in:
parent
858d3a5b72
commit
1ac3b7558a
|
|
@ -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