#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

#2145 in Command line utilities

Download history 20396/week @ 2023-12-13 15202/week @ 2023-12-20 17074/week @ 2023-12-27 20680/week @ 2024-01-03 21209/week @ 2024-01-10 25747/week @ 2024-01-17 23384/week @ 2024-01-24 25386/week @ 2024-01-31 26790/week @ 2024-02-07 26024/week @ 2024-02-14 28422/week @ 2024-02-21 29141/week @ 2024-02-28 32356/week @ 2024-03-06 28577/week @ 2024-03-13 29612/week @ 2024-03-20 22319/week @ 2024-03-27

118,034 downloads per month
Used in 185 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