aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/pkg.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/pkg.go')
-rw-r--r--internal/pkg/pkg.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index b8a997d8..9a6d5201 100644
--- a/internal/pkg/pkg.go
+++ b/internal/pkg/pkg.go
@@ -2443,6 +2443,37 @@ func open(
c.unlock = func() {}
}
+ for _, name := range []string{
+ dirWork,
+ dirTemp,
+ } {
+ dents, err := os.ReadDir(base.Append(name).String())
+ if err != nil {
+ if errors.Is(err, os.ErrNotExist) {
+ continue
+ }
+ c.unlock()
+ return nil, err
+ }
+ if len(dents) != 0 {
+ c.unlock()
+ return nil, fmt.Errorf(
+ "%s is not empty, scrub likely required",
+ name,
+ )
+ }
+ }
+
+ if _, err := os.ReadDir(base.Append(
+ dirExecScratch,
+ ).String()); !errors.Is(err, os.ErrNotExist) {
+ c.unlock()
+ if err != nil {
+ return nil, err
+ }
+ return nil, errors.New(dirExecScratch + " is present, scrub likely required")
+ }
+
variantPath := base.Append(fileVariant).String()
if p, err := os.ReadFile(variantPath); err != nil {
if !errors.Is(err, os.ErrNotExist) {