-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #36425, fix #36354 ## How to detect WSL? There are a number of ways that can be used to detect WSL environments, but each can have false positives. We finally chose to use the same method as Snapd to detect WSL. Because Windows installs Ubuntu LTS as WSL by default. So we assume that Snapd's detection method will work for most users. - Ubuntu/Snapd: https://github.com/canonical/snapd/blob/03a578a5dff26467dcc80580fcd4720a486185a5/release/release.go#L151-L172 - microsoft/WSL#423 - microsoft/WSL#4071 - https://superuser.com/q/1749781/1460597 ## Known limitations - this is a runtime test, and thus cannot meaningfully be used in `@static if` constructs. - Linux users can create their own - `/proc/sys/fs/binfmt_misc/WSLInterop` file - or `/run/WSL/` folder to pretend to be a WSL environment. --- - I've tested this under: Ubuntu 22.04.5 LTS (default/Offical) and alpine-release-3.17.0 (win store) - [x] Add compat, NEWS, tests - [x] Take a look at different detect methods, figure out which one is more robust --------- Co-authored-by: Gautam Mishra <[email protected]> Co-authored-by: Max Horn <[email protected]> Co-authored-by: Chengyu Han <[email protected]> Co-authored-by: Alex Arslan <[email protected]>
- Loading branch information
1 parent
4e13e0e
commit 323ca86
Showing
4 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters