#process-running #wsl #linux #subsystem #windows #bash

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

#2371 in Command line utilities

Download history 28836/week @ 2024-03-14 30032/week @ 2024-03-21 26810/week @ 2024-03-28 30267/week @ 2024-04-04 34889/week @ 2024-04-11 36051/week @ 2024-04-18 36296/week @ 2024-04-25 38977/week @ 2024-05-02 38974/week @ 2024-05-09 38876/week @ 2024-05-16 37585/week @ 2024-05-23 38203/week @ 2024-05-30 34502/week @ 2024-06-06 36804/week @ 2024-06-13 39283/week @ 2024-06-20 32327/week @ 2024-06-27

149,334 downloads per month
Used in 238 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

~51KB