mirror of
https://github.com/thegeeklab/wp-opentofu.git
synced 2024-11-21 14:20:40 +00:00
fix: delete workdir recursively
This commit is contained in:
parent
4b5f3e55ad
commit
2187524271
@ -33,7 +33,9 @@ func installPackage(ctx context.Context, client *http.Client, version string, ma
|
||||
return fmt.Errorf("failed to create tmp dir: %w", err)
|
||||
}
|
||||
|
||||
defer os.RemoveAll(tmpdir)
|
||||
defer func() {
|
||||
_ = deleteDir(tmpdir)
|
||||
}()
|
||||
|
||||
log.Debug().
|
||||
Str("tmpdir", tmpdir).
|
||||
@ -169,9 +171,5 @@ func sanitizeArchivePath(d, t string) (string, error) {
|
||||
}
|
||||
|
||||
func deleteDir(path string) error {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return os.Remove(path)
|
||||
return os.RemoveAll(path)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user