MCPcopy Index your code
hub / github.com/coder/code-server / isWsl

Function isWsl

src/node/util.ts:372–390  ·  view source on GitHub ↗
(
  platform: NodeJS.Platform,
  osRelease: string,
  procVersionFilePath: string,
)

Source from the content-addressed store, hash-verified

370 * @returns {Boolean} boolean if it is WSL
371 */
372export const isWsl = async (
373 platform: NodeJS.Platform,
374 osRelease: string,
375 procVersionFilePath: string,
376): Promise<boolean> => {
377 if (platform !== "linux") {
378 return false
379 }
380
381 if (osRelease.toLowerCase().includes("microsoft")) {
382 return true
383 }
384
385 try {
386 return (await fs.readFile(procVersionFilePath, "utf8")).toLowerCase().includes("microsoft")
387 } catch (_) {
388 return false
389 }
390}
391
392interface OpenOptions {
393 args: string[]

Callers 1

openFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected