An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Detect if the code is ran under Windows Subsystem for Linux

[![On crates.io](https://img.shields.io/crates/v/wsl.svg)](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`.