Skip to content

fix: ensure stdout is string before trim in execFile results - #288

Merged
avoidwork merged 1 commit into
mainfrom
fix/searchfiles-stdout-trim
Jun 17, 2026
Merged

fix: ensure stdout is string before trim in execFile results#288
avoidwork merged 1 commit into
mainfrom
fix/searchfiles-stdout-trim

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Fix recurring `stdout.trim is not a function` error in the searchFiles tool (and session_search). The `execFile` call can return stdout as a Buffer in edge cases (timeouts, encoding mismatches, process kills) even when `encoding: 'utf-8'` is specified. Coerce stdout to string via `String()` before calling `.trim()`.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)

Testing

All 1133 tests pass. The fix is a defensive coercion — `String()` is a no-op if stdout is already a string, and safely converts a Buffer to its UTF-8 representation otherwise.

Coverage

  • 100% line coverage maintained

Checklist

  • `npm run lint` passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

@avoidwork avoidwork self-assigned this Jun 17, 2026
@avoidwork
avoidwork enabled auto-merge (squash) June 17, 2026 12:05
@avoidwork
avoidwork merged commit 8e18b27 into main Jun 17, 2026
3 checks passed
@avoidwork
avoidwork deleted the fix/searchfiles-stdout-trim branch June 17, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant