diff --git a/pkg/executor/executor.go b/pkg/executor/executor.go index 689b2388a8..d32b8da3c8 100644 --- a/pkg/executor/executor.go +++ b/pkg/executor/executor.go @@ -84,9 +84,11 @@ func (c *CommandRunner) CreateTempFile(tempFilePrefix string, content []byte) (s if err != nil { return "", err } + defer tempFile.Close() _, err = tempFile.Write(content) if err != nil { + os.Remove(tempFile.Name()) return "", err }