mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-08-22 09:05:44 +00:00
close after operations
This commit is contained in:
parent
32b3bb47a2
commit
0154216c33
@ -23,7 +23,7 @@ type InteractiveSwitchOp struct {
|
||||
func (op InteractiveSwitchOp) Run(_, stderr io.Writer) error {
|
||||
// parse kubeconfig just to see if it can be loaded
|
||||
kc := new(kubeconfig.Kubeconfig).WithLoader(kubeconfig.DefaultLoader)
|
||||
defer kc.Close()
|
||||
|
||||
if err := kc.Parse(); err != nil {
|
||||
if cmdutil.IsNotFoundErr(err) {
|
||||
printer.Warning(stderr, "kubeconfig file not found")
|
||||
@ -37,6 +37,7 @@ func (op InteractiveSwitchOp) Run(_, stderr io.Writer) error {
|
||||
err := printer.Warning(stderr, "No kubectl context found")
|
||||
return errors.Wrap(err, "kubeconfig error")
|
||||
}
|
||||
kc.Close()
|
||||
|
||||
cmd := exec.Command("fzf", "--ansi", "--no-preview")
|
||||
var out bytes.Buffer
|
||||
|
Loading…
Reference in New Issue
Block a user