MCPcopy
hub / github.com/coder/mux / looksLikeWslShell

Function looksLikeWslShell

src/node/utils/main/resolveLocalPtyShell.ts:117–133  ·  view source on GitHub ↗
(envShell: string)

Source from the content-addressed store, hash-verified

115}
116
117function looksLikeWslShell(envShell: string): boolean {
118 // WSL (and other Unix-like environments) often surface POSIX-y paths like `/bin/bash`.
119 // Those paths don't exist on Windows hosts, so treat them as WSL and ignore.
120 if (envShell.startsWith("/")) {
121 return true;
122 }
123
124 const normalized = envShell.replace(/\//g, "\\").toLowerCase();
125 const base = path.win32.basename(normalized);
126 return (
127 normalized === "wsl" ||
128 base === "wsl.exe" ||
129 normalized === "bash" ||
130 normalized === "bash.exe" ||
131 normalized.endsWith("\\windows\\system32\\bash.exe")
132 );
133}
134
135/**
136 * Resolve the best shell to use for a *local* PTY session.

Callers 1

resolveLocalPtyShellFunction · 0.85

Calls 1

basenameMethod · 0.45

Tested by

no test coverage detected