From 16149010a7443f6b7e2d8590a084ccedf42e0983 Mon Sep 17 00:00:00 2001 From: Li Zhijian Date: Wed, 13 Jan 2021 13:27:07 +0800 Subject: [PATCH] :bug: internal: fix a possible temporary directory leak a temporary directory leak was found when running the tests Signed-off-by: Li Zhijian --- pkg/internal/testing/integration/internal/process.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/internal/testing/integration/internal/process.go b/pkg/internal/testing/integration/internal/process.go index 99e2fdea3d..501f48f4c3 100644 --- a/pkg/internal/testing/integration/internal/process.go +++ b/pkg/internal/testing/integration/internal/process.go @@ -98,6 +98,9 @@ func DoDefaulting( if path == "" { if name == "" { + if defaults.DirNeedsCleaning { + os.RemoveAll(defaults.Dir) + } return DefaultedProcessInput{}, fmt.Errorf("must have at least one of name or path") } defaults.Path = BinPathFinder(name)