Skip to content

Conversation

@CCavalancia
Copy link

Summary

  • Fixes Windows-specific libuv assertion failure (UV_HANDLE_CLOSING) that occurs during session startup
  • Eliminates DEP0190 deprecation warnings about unescaped arguments with shell: true
  • Introduces needsShell() helper to intelligently determine when shell is required

Problem

On Windows, using shell: true with spawnSync causes:

  1. Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c, line 76
  2. [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities

Solution

  • Prioritize checking common installation paths (e.g., ~/.bun/bin/bun.exe) before PATH resolution
  • When we have an absolute path to an executable, run it directly without shell
  • Only use shell: true when running bare command names that require PATH resolution

Test plan

  • Tested on Windows 11 with Bun 1.3.5
  • Verified no assertion failures on session startup
  • Verified bun/uv version detection works correctly
  • Verified bun install runs without errors
  • Maintainer verification on macOS/Linux (no behavioral changes expected)

🤖 Generated with Claude Code

On Windows, using `shell: true` with spawnSync can cause:
- DEP0190 deprecation warnings about unescaped arguments
- libuv assertion failures (UV_HANDLE_CLOSING race condition)

This fix introduces a `needsShell()` helper that:
- Returns false for absolute paths (no shell needed for .exe files)
- Returns true only for bare command names requiring PATH resolution
- Always returns false on non-Windows platforms

Changes:
- Prioritize checking common installation paths before PATH resolution
- Use spawnSync with shell: false when full executable path is available
- Add `isAbsolute` import from 'path' module
- Update all spawn/exec calls to use needsShell() helper

Tested on Windows 11 with Bun 1.3.5 - no assertion failures.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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