Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.52 KB

File metadata and controls

29 lines (21 loc) · 1.52 KB

← Back to Backlog

[BUG-001] ✅ DONE - WSL Manager fails when no distributions are installed

Status: Done (2026-01-29) Priority: High Component: tools/pslib/wsl/lib/core.ps1

Description: When no WSL distributions are installed, wsl-manager crashed with a type conversion error when parsing WSL verbose output that contained informational messages instead of distribution entries.

Root Cause: The parser in Get-WslDistroList -Detailed attempted to convert the last field of every non-header line to an integer (the VERSION field). When WSL outputs informational messages like "No distributions found", the parser tried to convert non-numeric text to [int], causing the crash.

Solution: Added validation using [int]::TryParse() before attempting to convert the version field. Lines that don't have a valid numeric version are now skipped, allowing the function to gracefully handle informational messages and return an empty array.

Changes:

  • Modified Get-WslDistroList in tools/pslib/wsl/lib/core.ps1:116-130 to validate version field before parsing
  • Added 2 new test cases in tools/pslib/wsl/lib/core.Tests.ps1 to cover edge cases with no distributions

Acceptance Criteria Met:

  • No error when running wsl-manager with zero distributions installed
  • Clear message indicating no distributions are available
  • Proper exit handling (gracefully returns empty array)
  • Unit tests covering zero-distribution scenario
  • All tests pass

← Back to Backlog