internal/pkg: check filtered error

This avoids filtering some unrelated os.ErrExist.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-04 17:42:27 +09:00
parent 94e3debc63
commit 6fdd800b2b

View File

@@ -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
}
}
}