MCPcopy
hub / github.com/smallstep/cli / IsWSL

Function IsWSL

exec/exec.go:31–37  ·  view source on GitHub ↗

IsWSL returns true if Windows Subsystem for Linux is detected. "Official" way of detecting WSL https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364

()

Source from the content-addressed store, hash-verified

29// "Official" way of detecting WSL
30// https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364
31func IsWSL() bool {
32 b, err := os.ReadFile("/proc/sys/kernel/osrelease")
33 if err != nil {
34 return false
35 }
36 return strings.Contains(strings.ToLower(string(b)), "microsoft") || strings.Contains(strings.ToLower(string(b)), "wsl")
37}
38
39// Exec is wrapper over syscall.Exec, invokes the execve(2) system call. On
40// windows it executes Run with the same arguments.

Callers 1

OpenInBrowserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…