Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify a PowerShell terminal #2671

Merged
merged 12 commits into from
Aug 8, 2022
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Bug Fixes:
- Clear output channel after auto-reconfigure. [#2628](https://github.com/microsoft/vscode-cmake-tools/issues/2628)
- Don't delete CMakeCache.txt when switching kits if the buildDirectory also changes. [#2546](https://github.com/microsoft/vscode-cmake-tools/issues/2546) [@david-fong](https://github.com/david-fong)
- Add "description" properties to the cmake.revealLog setting. [#2578](https://github.com/microsoft/vscode-cmake-tools/issues/2578)

- Fix issues with launching the target in PowerShell terminal. [#2650](https://github.com/microsoft/vscode-cmake-tools/issues/2650) [#2621](https://github.com/microsoft/vscode-cmake-tools/issues/2621) [#535](https://github.com/microsoft/vscode-cmake-tools/issues/535)
- Detect clang-cl.exe compilers that are not bundled with Visual Studio. [#2622](https://github.com/microsoft/vscode-cmake-tools/issues/2622)

## 1.11.26
Expand Down
20 changes: 13 additions & 7 deletions src/cmakeTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2220,15 +2220,21 @@ export class CMakeTools implements api.CMakeToolsAPI {
}

const userConfig = this.workspaceContext.config.debugConfig;
const terminal = await this.createTerminal(executable);
const terminal: vscode.Terminal = await this.createTerminal(executable);

let executablePath = shlex.quote(executable.path);

if (process.platform === 'win32') {
executablePath = executablePath.replace(/\\/g, "/");

if (vscode.env.shell.indexOf("PowerShell") > 0) {
executablePath = `.${executablePath}`;
if (executablePath.startsWith("\"")) {
let launchTerminalPath = (terminal.creationOptions as vscode.TerminalOptions).env![this.launchTerminalPath];
if (process.platform === 'win32') {
executablePath = executablePath.replace(/\\/g, "/");
launchTerminalPath = launchTerminalPath?.toLocaleLowerCase();
if (launchTerminalPath?.includes("pwsh.exe") || launchTerminalPath?.includes("powershell")) {
executablePath = `.${executablePath}`;
}
} else {
if (launchTerminalPath?.endsWith("pwsh")) {
executablePath = `.${executablePath}`;
}
}
}

Expand Down