Merge pull request #4115 from PeterPonyu/fix/3726-glob-grep-broken-symlinks
fix(glob,grep): tolerate broken symlinks and non-fatal I/O warnings (#3726)
This commit is contained in:
@@ -54,6 +54,17 @@ describe("buildRgArgs", () => {
|
||||
const args = buildRgArgs({ pattern: "**/*.tsx" })
|
||||
expect(args).toContain("--glob=**/*.tsx")
|
||||
})
|
||||
|
||||
// Regression for #3726: broken/dangling symlinks should not surface as
|
||||
// tool errors. --no-messages silences ripgrep's non-fatal stderr warnings
|
||||
// for I/O issues (broken symlinks, permission denied) without suppressing
|
||||
// fatal-error messages, so the existing "exit code > 1 && stderr.trim()"
|
||||
// gate sees a clean stream for soft I/O issues but still triggers on real
|
||||
// fatal ripgrep errors.
|
||||
it("includes --no-messages so broken symlinks do not error the tool (#3726)", () => {
|
||||
const args = buildRgArgs({ pattern: "*.ts" })
|
||||
expect(args).toContain("--no-messages")
|
||||
})
|
||||
})
|
||||
|
||||
describe("buildFindArgs", () => {
|
||||
|
||||
@@ -9,4 +9,8 @@ export const RG_FILES_FLAGS = [
|
||||
"--files",
|
||||
"--color=never",
|
||||
"--glob=!.git/*",
|
||||
// Suppress stderr warnings on broken/dangling symlinks and similar
|
||||
// non-fatal I/O issues so they don't tip the tool into the error branch.
|
||||
// See #3726.
|
||||
"--no-messages",
|
||||
] as const
|
||||
|
||||
@@ -12,6 +12,10 @@ export const RG_SAFETY_FLAGS = [
|
||||
"--no-heading",
|
||||
"--line-number",
|
||||
"--with-filename",
|
||||
// Suppress stderr warnings on broken/dangling symlinks and similar
|
||||
// non-fatal I/O issues so they don't tip the tool into the error branch.
|
||||
// See #3726.
|
||||
"--no-messages",
|
||||
] as const
|
||||
|
||||
export const GREP_SAFETY_FLAGS = ["-n", "-H", "--color=never"] as const
|
||||
|
||||
Reference in New Issue
Block a user