https://github.com/dentosal/wsl-rs
Detect if the program is running under Windows Subsystem for Linux
https://github.com/dentosal/wsl-rs
Last synced: over 1 year ago
JSON representation
Detect if the program is running under Windows Subsystem for Linux
- Host: GitHub
- URL: https://github.com/dentosal/wsl-rs
- Owner: Dentosal
- License: mit
- Created: 2019-06-12T19:15:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-27T22:59:44.000Z (almost 4 years ago)
- Last Synced: 2024-04-24T15:13:25.586Z (about 2 years ago)
- Language: Rust
- Size: 1.95 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Detect if the code is ran under Windows Subsystem for Linux
[](https://crates.io/crates/wsl)
## Usage
`wsl::is_wsl()` returns true under WSL, false otherwise.
## Method
[A semi-official source](https://github.com/microsoft/WSL/issues/423#issuecomment-221627364) lists some pointers. We are going to use the simplest approach here: Testing if `/proc/sys/kernel/osrelease` contains string `Microsoft` or `WSL`.