diff options
| author | Haris Gušić <[email protected]> | 2025-10-24 01:05:01 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-23 18:05:01 -0500 |
| commit | 50cc641288e66479e0ef0a1e2de064a7f787d996 (patch) | |
| tree | 7d9037bc881efde1d3a4e956d24d628be5c76be3 | |
| parent | 4c90bf3e078915024fa8c013e2eaa038ce94f4b8 (diff) | |
| download | opencode-50cc641288e66479e0ef0a1e2de064a7f787d996.tar.gz opencode-50cc641288e66479e0ef0a1e2de064a7f787d996.zip | |
fix: Opencode fails with ENOENT posix_spawn '/usr/bin/rg' (#3396)
| -rw-r--r-- | packages/opencode/src/file/ripgrep.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts index d023f47c3..f575154e0 100644 --- a/packages/opencode/src/file/ripgrep.ts +++ b/packages/opencode/src/file/ripgrep.ts @@ -211,6 +211,16 @@ export namespace Ripgrep { } } + // Bun.spawn should throw this, but it incorrectly reports that the executable does not exist. + // See https://github.com/oven-sh/bun/issues/24012 + if (!(await fs.stat(input.cwd).catch(() => undefined))?.isDirectory()) { + throw Object.assign(new Error(`No such file or directory: '${input.cwd}'`), { + code: "ENOENT", + errno: -2, + path: input.cwd, + }); + } + const proc = Bun.spawn(args, { cwd: input.cwd, stdout: "pipe", |
