fix(opencode): add AbortSignal support to Ripgrep.files() and GlobTool (#10833)

This commit is contained in:
Goni Zahavy
2026-01-29 02:47:09 +02:00
committed by GitHub
parent 90a7e3d64e
commit e5b33f8a5e
3 changed files with 12 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ export const GlobTool = Tool.define("glob", {
for await (const file of Ripgrep.files({
cwd: search,
glob: [params.pattern],
signal: ctx.abort,
})) {
if (files.length >= limit) {
truncated = true

View File

@@ -56,7 +56,7 @@ export const ListTool = Tool.define("list", {
const ignoreGlobs = IGNORE_PATTERNS.map((p) => `!${p}*`).concat(params.ignore?.map((p) => `!${p}`) || [])
const files = []
for await (const file of Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs })) {
for await (const file of Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs, signal: ctx.abort })) {
files.push(file)
if (files.length >= LIMIT) break
}