diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts index d6279436f55816b103ce21ba001907c207d9db97..370cb709b9bb6d9394aacedaba33c3973cb9ad38 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts @@ -6,6 +6,7 @@ import * as nls from 'vs/nls'; import * as pfs from 'vs/base/node/pfs'; import * as platform from 'vs/base/common/platform'; +import * as os from 'os'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; @@ -213,10 +214,21 @@ export class TerminalService extends AbstractTerminalService implements ITermina // module doesn't work if this is not the case. See #27915. const is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'); const system32Path = `${process.env['windir']}\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}`; + + const osVersion = (/(\d+)\.(\d+)\.(\d+)/g).exec(os.release()); + let useWSLexe = false; + + if (osVersion.length === 4) { + const buildNumber = parseInt(osVersion[3]); + if (buildNumber >= 16299) { + useWSLexe = true; + } + } + const expectedLocations = { 'Command Prompt': [`${system32Path}\\cmd.exe`], PowerShell: [`${system32Path}\\WindowsPowerShell\\v1.0\\powershell.exe`], - 'WSL Bash': [`${system32Path}\\bash.exe`], + 'WSL Bash': [`${system32Path}\\${useWSLexe ? 'wsl.exe' : 'bash.exe'}`], 'Git Bash': [ `${process.env['ProgramW6432']}\\Git\\bin\\bash.exe`, `${process.env['ProgramW6432']}\\Git\\usr\\bin\\bash.exe`,