forked from security/hakurei
internal/pkg: check filtered error
This avoids filtering some unrelated os.ErrExist. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -163,10 +163,14 @@ func (t *TContext) destroy(errP *error) {
|
||||
if chmodErr != nil || removeErr != nil {
|
||||
*errP = errors.Join(*errP, chmodErr, removeErr)
|
||||
} else if errors.Is(*errP, os.ErrExist) {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if t.status != nil {
|
||||
if err := t.status.Close(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user