Skip to content

Commit

Permalink
fix make clean (#34134) (#34141)
Browse files Browse the repository at this point in the history
- when cleaning the project it ignore 'permission denied' errors
- remove broken make call
  • Loading branch information
AndersonQ authored Dec 29, 2022
1 parent d8204a2 commit acd70e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ update: notice
clean: mage
@rm -rf build
@$(foreach var,$(PROJECTS) $(PROJECTS_XPACK_MAGE),$(MAKE) -C $(var) clean || exit 1;)
@$(MAKE) -C generator clean
@-mage -clean

## check : TBD.
Expand Down
11 changes: 11 additions & 0 deletions dev-tools/mage/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
package mage

import (
"errors"
"fmt"
"os"
"strings"

"github.com/magefile/mage/sh"
)

Expand Down Expand Up @@ -46,6 +51,12 @@ func Clean(pathLists ...[]string) error {
for _, f := range paths {
f = MustExpand(f)
if err := sh.Rm(f); err != nil {
if errors.Is(err, os.ErrPermission) ||
strings.Contains(err.Error(), "permission denied") {
fmt.Printf("warn: cannot delete %q: %v, proceeding anyway\n",
f, err)
continue
}
return err
}
}
Expand Down

0 comments on commit acd70e9

Please sign in to comment.