()
| 30 | * When running on Windows, but inside WSL, shell commands need to run using the WSL environment. |
| 31 | */ |
| 32 | export function isRunningInWsl(): boolean { |
| 33 | // WSL only applies when platform reports as Linux |
| 34 | if (process.platform !== "linux") { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | if (process.env.WSL_DISTRO_NAME) { |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | // Check /proc/version for Microsoft/WSL indicators |
| 43 | try { |
| 44 | const procVersion = fs.readFileSync("/proc/version", "utf8").toLowerCase(); |
| 45 | return procVersion.includes("microsoft") || procVersion.includes("wsl"); |
| 46 | } catch { |
| 47 | return false; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | function getBashMaxChars(): number { |
| 52 | return parseEnvNumber( |
no outgoing calls
no test coverage detected