Skip to main content

detect_wsl2

Function detect_wsl2 

Source
pub fn detect_wsl2() -> WslStatus
Expand description

Detect WSL2 availability on the current system.

Returns a WslStatus indicating whether WSL2 is available, not installed, or if detection encountered an error. Detection completes within 5 seconds and never panics.

§Platform Behavior

  • Windows: Checks wsl --list --verbose output for version 2 distros
  • Linux: Checks /proc/version for WSL indicators (running inside WSL)

§Examples

use rusty_stack::platform::wsl::detect_wsl2;

let status = detect_wsl2();
println!("WSL2 status: {:?}", status);