#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

#2 in #wsl

Download history 20591/week @ 2024-01-05 23562/week @ 2024-01-12 23944/week @ 2024-01-19 24682/week @ 2024-01-26 25419/week @ 2024-02-02 26156/week @ 2024-02-09 27478/week @ 2024-02-16 28026/week @ 2024-02-23 31213/week @ 2024-03-01 30004/week @ 2024-03-08 29287/week @ 2024-03-15 29721/week @ 2024-03-22 26851/week @ 2024-03-29 30483/week @ 2024-04-05 35976/week @ 2024-04-12 30503/week @ 2024-04-19

128,457 downloads per month
Used in 193 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