mirror of
https://github.com/thegeeklab/wp-opentofu.git
synced 2024-11-24 13:20:39 +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)
|
return fmt.Errorf("failed to create tmp dir: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer os.RemoveAll(tmpdir)
|
defer func() {
|
||||||
|
_ = deleteDir(tmpdir)
|
||||||
|
}()
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("tmpdir", tmpdir).
|
Str("tmpdir", tmpdir).
|
||||||
@ -169,9 +171,5 @@ func sanitizeArchivePath(d, t string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deleteDir(path string) error {
|
func deleteDir(path string) error {
|
||||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
return os.RemoveAll(path)
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return os.Remove(path)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user