Skip to content

Conversation

@christso
Copy link

Summary

  • Add commandExists() check before attempting to spawn browser opener
  • Prevents crash when xdg-open is not installed (Docker, WSL, CI, etc.)
  • The URL is still printed, so users can manually open it in their browser
  • Added tests for graceful handling when command is missing

Changes

File Description
lib/auth/browser.ts Added commandExists() helper that uses which/where to check if command exists before spawning
test/browser.test.ts Added 2 tests to verify graceful handling when opener command is missing

Test Results

All 211 tests pass:

 ✓ test/browser.test.ts (6 tests) 50ms
 Test Files  9 passed (9)
      Tests  211 passed (211)

Test Plan

  • Existing tests pass
  • New tests added for missing command scenario
  • Manually verified fix works by clearing PATH and calling openBrowserUrl()

Closes #83

🤖 Generated with Claude Code

- Add commandExists() check before attempting to spawn browser opener
- Prevents crash when xdg-open is not installed (Docker, WSL, CI, etc.)
- The URL is still printed, so users can manually open it
- Added tests for graceful handling when command is missing

Fixes numman-ali#83

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

[BUG] Auth flow crashes when xdg-open is not installed in headless environments

1 participant