Skip to content

Commit

Permalink
fix #2261: ignore EPERM errors on directories
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed May 25, 2022
1 parent f0bef33 commit 18657e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

This was contributed by [@lbwa](https://github.com/lbwa).

* Ignore `EPERM` errors on directories ([#2261](https://github.com/evanw/esbuild/issues/2261))

Previously bundling with esbuild when inside a sandbox environment which does not have permission to access the parent directory did not work because esbuild would try to read the directory to search for a `node_modules` folder and would then fail the build when that failed. In practice this caused issues with running esbuild with `sandbox-exec` on macOS. With this release, esbuild will treat directories with permission failures as empty to allow for the `node_modules` search to continue past the denied directory and into its parent directory. This means it should now be possible to bundle with esbuild in these situations. This fix is similar to the fix in version 0.9.1 but is for `EPERM` while that fix was for `EACCES`.

## 0.14.39

* Fix code generation for `export default` and `/* @__PURE__ */` call ([#2203](https://github.com/evanw/esbuild/issues/2203))
Expand Down
2 changes: 1 addition & 1 deletion internal/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ func (r resolverQuery) dirInfoUncached(path string) *dirInfo {

// List the directories
entries, err, originalError := r.fs.ReadDirectory(path)
if err == syscall.EACCES {
if err == syscall.EACCES || err == syscall.EPERM {
// Just pretend this directory is empty if we can't access it. This is the
// case on Unix for directories that only have the execute permission bit
// set. It means we will just pass through the empty directory and
Expand Down

0 comments on commit 18657e0

Please sign in to comment.