Skip to content

Commit

Permalink
fix: match for WSL platform in case-insentive way
Browse files Browse the repository at this point in the history
```
$ cat /proc/sys/kernel/osrelease
4.19.128-microsoft-standard
```

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed May 17, 2022
1 parent ee8113b commit 5a8e011
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/provision/providers/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (p *provisioner) GetFirstInterface() string {
func detectWSL() bool {
// "Official" way of detecting WSL https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364
contents, err := os.ReadFile("/proc/sys/kernel/osrelease")
if err == nil && (bytes.Contains(contents, []byte("Microsoft")) || bytes.Contains(contents, []byte("WSL"))) {
if err == nil && (bytes.Contains(bytes.ToLower(contents), []byte("microsoft")) || bytes.Contains(bytes.ToLower(contents), []byte("wsl"))) {
return true
}

Expand Down

0 comments on commit 5a8e011

Please sign in to comment.