From 6b2d872d793d241b5fa9abfa9674c4d49bc59eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20G=C3=BC=C3=A7l=C3=BC?= Date: Fri, 22 Dec 2023 09:50:48 +0300 Subject: [PATCH] Initialize default attach func regardless of the value of flag Kubernetes-commit: cde050c4d0b02003d34f7056bd038fe8f4accc42 --- pkg/cmd/debug/debug.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/cmd/debug/debug.go b/pkg/cmd/debug/debug.go index bbabe09e7..456ebc4b7 100644 --- a/pkg/cmd/debug/debug.go +++ b/pkg/cmd/debug/debug.go @@ -213,14 +213,15 @@ func (o *DebugOptions) Complete(restClientGetter genericclioptions.RESTClientGet attachFlag := cmd.Flags().Lookup("attach") if !attachFlag.Changed && o.Interactive { o.Attach = true - // Downstream tools may want to use their own customized - // attach function to do extra work or use attach command - // with different flags instead of the static one defined in - // handleAttachPod. But if this function is not set explicitly, - // we fall back to default. - if o.AttachFunc == nil { - o.AttachFunc = o.handleAttachPod - } + } + + // Downstream tools may want to use their own customized + // attach function to do extra work or use attach command + // with different flags instead of the static one defined in + // handleAttachPod. But if this function is not set explicitly, + // we fall back to default. + if o.AttachFunc == nil { + o.AttachFunc = o.handleAttachPod } // Environment