Skip to content

Commit

Permalink
Fix pnpm #549
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Jan 26, 2022
1 parent c928022 commit dc5c45e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions cli/internal/fs/copy_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ func RecursiveCopy(from string, to string, mode os.FileMode) error {
return RecursiveCopyOrLinkFile(from, to, mode, false, false)
}

// RecursiveLink hardlinks either a single file or a directory.
// Note that you can't hardlink directories so the behaviour is much the same as a recursive copy.
// If it can't link then it falls back to a copy.
// 'mode' is the mode of the destination file.
func RecursiveLink(from string, to string, mode os.FileMode) error {
return RecursiveCopyOrLinkFile(from, to, mode, true, true)
}

// RecursiveCopyOrLinkFile recursively copies or links a file or directory.
// 'mode' is the mode of the destination file.
// If 'link' is true then we'll hardlink files instead of copying them.
Expand Down Expand Up @@ -84,7 +76,11 @@ func WalkMode(rootPath string, callback func(name string, isDir bool, mode os.Fi
if isDirLike, err := info.IsDirOrSymlinkToDir(); err == nil {
return callback(name, isDirLike, info.ModeType())
} else {
return err
// Skip running callback on "dead" symlink (symlink to directory that doesn't exist)
if err, ok := err.(*os.PathError); !ok {
return err
}
return nil
}
},
Unsorted: true,
Expand Down

0 comments on commit dc5c45e

Please sign in to comment.