#wsl #windows #is-wsl

is-wsl

Checks if the process is running inside Windows Subsystem for Linux

4 releases (breaking)

Uses old Rust 2015

0.4.0 Jan 27, 2023
0.3.0 Jan 23, 2023
0.2.0 Jan 22, 2023
0.1.0 Jan 21, 2023

#1254 in Command line utilities

Download history 68437/week @ 2024-12-14 41134/week @ 2024-12-21 48603/week @ 2024-12-28 74831/week @ 2025-01-04 75004/week @ 2025-01-11 78076/week @ 2025-01-18 84913/week @ 2025-01-25 83264/week @ 2025-02-01 86461/week @ 2025-02-08 81344/week @ 2025-02-15 86197/week @ 2025-02-22 84531/week @ 2025-03-01 88839/week @ 2025-03-08 99832/week @ 2025-03-15 84767/week @ 2025-03-22 68744/week @ 2025-03-29

356,014 downloads per month
Used in 368 crates (3 directly)

MIT license

5KB

is-wsl

Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)

Inspired by sindresorhus/is-wsl and made for Rust lang.

Can be useful if you need to work around unimplemented or buggy features in WSL. Supports both WSL 1 and WSL 2.

Usage

$> cargo add is-wsl

main.rs


use is_wsl::is_wsl

fn main() {
    if is_wsl() {
        // Do some WSL related stuff 🎇
    } else {
        // Do some different things! <3
    }
}

Dependencies

~50KB