Disable launcher.bat script to unblock Git Bash users if windows username has blank spaces (#938)

* Disable launcher.bat script to unblock Git Bash users if windows user name has blank spaces

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>

* Use vscode.env.shell API to get current shell
This commit is contained in:
Jinbo Wang 2021-01-21 16:13:36 +08:00 committed by GitHub
parent e3c99ec889
commit b2a4831995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -307,7 +307,10 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
}
if (process.platform === "win32" && config.console !== "internalConsole") {
config.launcherScript = utility.getLauncherScriptPath();
const launcherScript: string = utility.getLauncherScriptPath();
if (!launcherScript.includes(" ") || !utility.isGitBash(config.console === "integratedTerminal")) {
config.launcherScript = launcherScript;
}
}
} else if (config.request === "attach") {
if (config.hostName && config.port) {

View File

@ -215,6 +215,18 @@ export function getLauncherScriptPath() {
return path.join(ext.extensionPath, "scripts", "launcher.bat");
}
export function isGitBash(isIntegratedTerminal: boolean): boolean {
const currentWindowsShellPath: string | undefined = isIntegratedTerminal ? vscode.env.shell :
vscode.workspace.getConfiguration("terminal")?.get("external.windowsExec");
if (!currentWindowsShellPath) {
return false;
}
const candidates: string[] = ["Git\\bin\\bash.exe", "Git\\bin\\bash", "Git\\usr\\bin\\bash.exe", "Git\\usr\\bin\\bash"];
const find: string | undefined = candidates.find((candidate: string) => currentWindowsShellPath.endsWith(candidate));
return !!find;
}
export enum ServerMode {
STANDARD = "Standard",
LIGHTWEIGHT = "LightWeight",