8000 Disable launcher.bat script to unblock Git Bash users if windows username has blank spaces by testforstephen · Pull Request #938 · microsoft/vscode-java-debug · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 12 additions & 0 deletions src/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
0