Skip to content

fix(grep): handle file paths without ENOTDIR error#233

Merged
LeeCheneler merged 1 commit intomainfrom
fix/grep-file-path-enotdir
Mar 29, 2026
Merged

fix(grep): handle file paths without ENOTDIR error#233
LeeCheneler merged 1 commit intomainfrom
fix/grep-file-path-enotdir

Conversation

@LeeCheneler
Copy link
Copy Markdown
Owner

Summary

Fix ENOTDIR error when the grep tool receives a file path instead of a directory path.

What Changed

When path points to a file, the grep tool now uses the file's parent directory as cwd and greps the specific file directly. Previously it passed the file path as the working directory to execSync, causing spawnSync /bin/sh ENOTDIR.

Two tests added: searching a single file by path, and no-matches for a single file.

When the path argument points to a file instead of a directory, use the
file's parent as cwd and grep the specific file. Previously this caused
an ENOTDIR error from execSync.
@github-actions github-actions Bot added the fix Bug fix label Mar 29, 2026
@LeeCheneler LeeCheneler merged commit 91a2070 into main Mar 29, 2026
4 checks passed
@LeeCheneler LeeCheneler deleted the fix/grep-file-path-enotdir branch March 29, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant