Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 7, 2025

This PR attempts to address Issue #9859. Feedback and guidance are welcome.

Problem

Users on Windows without PowerShell in their PATH were experiencing API request failures with the error:

Command failed with ENOENT: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
spawnSync powershell ENOENT

Solution

Added error handling around the osName() call in system-info.ts to gracefully handle cases where PowerShell is not available:

  • Wrapped osName() in a try-catch block
  • Provides a fallback using Node's built-in os.platform() and os.release() when osName() fails
  • Ensures the application continues to work regardless of PowerShell availability

Changes

  • Modified src/core/prompts/sections/system-info.ts to add error handling
  • Added comprehensive tests in src/core/prompts/sections/__tests__/system-info.spec.ts

Testing

  • Added unit tests covering both success and error scenarios
  • Tests verify the fallback mechanism works correctly when PowerShell is not available
  • All tests pass successfully

Fixes #9859

- Add try-catch block around osName() call to handle PowerShell not being available
- Provide fallback using os.platform() and os.release() when osName() fails
- Add comprehensive tests for both success and error scenarios
- Fixes #9859 where users without PowerShell in PATH get API request failures
@roomote
Copy link
Contributor Author

roomote bot commented Dec 7, 2025

Rooviewer Clock   See task on Roo Cloud

Re-reviewed the PR. The previous issue has been resolved.

  • Remove redundant String.prototype.toPosix setup/teardown in test file (already provided globally by vitest setup)
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 7, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 7, 2025

Fixaroo Clock   See task on Roo Cloud

Fixed the reported issue. All local checks passed.

View commit | Revert commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] 对话报错

3 participants