You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give a ❌ error, not a stack trace, when a path can not be looked at #788
When the file system gives an error while the files are found, the run crashes with a stack trace and not a ❌ error.
> rexreplace foo bar "{a,$(printf 'x%.0s' {1..300})}.md"
node:fs:1746
const stats = binding.stat(
^
Error: ENAMETOOLONG: name too long, stat '{a,xxxx…}.md'
at Object.statSync (node:fs:1746:25)
…
> rexreplace foo bar a.md/x
Error: ENOTDIR: not a directory, scandir '…/a.md'
The exit code is 1. Seen on main (6ea7b83) with Node 22 and Bun on macOS.
There are two places it comes from:
fs.statSync(file, {throwIfNoEntry: false}) in findFiles (src/engine.ts:776). throwIfNoEntry only covers ENOENT, so ENAMETOOLONG, ENOTDIR (on Bun) and EACCES are thrown.
globs.sync() right after it. fast-glob throws on the same errors (ENAMETOOLONG from lstat, ENOTDIR from scandir on Node).
--glob-pipe makes this easier to hit, as each piped line goes through findFiles.
Change
A path that can not be looked at is not a file, so it goes on to be globbed.
An error from the glob gives a ❌ error (or a panic), like any other problem with the input, and not a stack trace.
Activity
Fix error handling for rename to close #788 (#810)