From d49db3d75e178bc7c658bc02de115b0e66fb0aac Mon Sep 17 00:00:00 2001 From: "Alex." <36776298+Variiuz@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:35:36 +0200 Subject: [PATCH 1/2] fix WSL detection on non-english Windows locales --- src/cli/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index 83420ff..c7ff76c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -37,6 +37,15 @@ async function execWindowsCmdAsync(command: string): Promise<{ stdout: string; s }); } +async function isWslAvailable(): Promise { + try { + await execWindowsCmdAsync('wsl --status'); + return true; + } catch { + return false; + } +} + export class Cli { private static cliInstance: CodacyCli | null = null; @@ -67,9 +76,7 @@ export class Cli { Cli.cliInstance = new LinuxCodacyCli(rootPath, provider, organization, repository); } else if (platform === 'win32') { // is WSL installed? - const { stdout } = await execWindowsCmdAsync('wsl --status'); - const hasWSL = stdout.includes('Default Distribution'); - + const hasWSL = await isWslAvailable(); Cli.cliInstance = hasWSL ? new WinWSLCodacyCli(rootPath, provider, organization, repository) : new WinCodacyCli(rootPath, provider, organization, repository); From 5bfd03a5e7831f193c5ea5a800bb442b3d7919e3 Mon Sep 17 00:00:00 2001 From: "Alex." <36776298+Variiuz@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:53:44 +0200 Subject: [PATCH 2/2] Update src/cli/index.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/cli/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index c7ff76c..dbfd2fb 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -39,8 +39,8 @@ async function execWindowsCmdAsync(command: string): Promise<{ stdout: string; s async function isWslAvailable(): Promise { try { - await execWindowsCmdAsync('wsl --status'); - return true; + const { stdout } = await execWindowsCmdAsync('wsl -l -q'); + return stdout.trim().length > 0; } catch { return false; }