aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-04 17:42:27 +0900
committerOphestra <cat@gensokyo.uk>2026-03-04 17:43:17 +0900
commit6fdd800b2b421b32e7db373b576433126c4652a2 (patch)
tree2b2486e5f3becb0c8c2a0b35afa229ef24193a1c
parent94e3debc632b6f3f309218395339ca0e9ba754b7 (diff)
internal/pkg: check filtered error
This avoids filtering some unrelated os.ErrExist. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/pkg/pkg.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index 61ec511c..dd48d847 100644
--- a/internal/pkg/pkg.go
+++ b/internal/pkg/pkg.go
@@ -163,8 +163,12 @@ func (t *TContext) destroy(errP *error) {
if chmodErr != nil || removeErr != nil {
*errP = errors.Join(*errP, chmodErr, removeErr)
} else if errors.Is(*errP, os.ErrExist) {
- // two artifacts may be backed by the same file
- *errP = nil
+ var linkError *os.LinkError
+ if errors.As(*errP, &linkError) && linkError != nil &&
+ linkError.Op == "rename" {
+ // two artifacts may be backed by the same file
+ *errP = nil
+ }
}
}