MCPcopy Index your code
hub / github.com/coder/coder / isWSL

Function isWSL

cli/login.go:536–545  ·  view source on GitHub ↗

isWSL determines if coder-cli is running within Windows Subsystem for Linux

()

Source from the content-addressed store, hash-verified

534
535// isWSL determines if coder-cli is running within Windows Subsystem for Linux
536func isWSL() (bool, error) {
537 if runtime.GOOS == goosDarwin || runtime.GOOS == goosWindows {
538 return false, nil
539 }
540 data, err := os.ReadFile("/proc/version")
541 if err != nil {
542 return false, xerrors.Errorf("read /proc/version: %w", err)
543 }
544 return strings.Contains(strings.ToLower(string(data)), "microsoft"), nil
545}
546
547// openURL opens the provided URL via user's default browser
548func openURL(inv *serpent.Invocation, urlToOpen string) error {

Callers 1

openURLFunction · 0.85

Calls 3

ReadFileMethod · 0.65
ErrorfMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected