Skip to content

Commit

Permalink
Merge pull request #6620 from microsoft/seanmcm/cherryPick6619
Browse files Browse the repository at this point in the history
cherry pick6619
  • Loading branch information
sean-mcmanus authored Dec 4, 2020
2 parents a3de2f9 + 52fe795 commit adf9959
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Fix various task variables not getting resolved with `cppbuild` tasks. [#6538](https://github.com/microsoft/vscode-cpptools/issues/6538)
* Fix warnings not appearing with `cppbuild` tasks. [#6556](https://github.com/microsoft/vscode-cpptools/issues/6556)
* Fix endless CPU/memory usage if the cpptools process crashes. [#6603](https://github.com/microsoft/vscode-cpptools/issues/6603)
* Fix the default `cwd` for `cppbuild` tasks. [#6618](https://github.com/microsoft/vscode-cpptools/issues/6618)

## Version 1.1.2: November 17, 2020
### Bug Fix
Expand Down
7 changes: 5 additions & 2 deletions Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,13 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
newConfig.preLaunchTask = task.name;
newConfig.externalConsole = false;
const exeName: string = path.join("${fileDirname}", "${fileBasenameNoExtension}");
newConfig.program = platform === "win32" ? exeName + ".exe" : exeName;
const isWindows: boolean = platform === 'win32';
newConfig.program = isWindows ? exeName + ".exe" : exeName;
// Add the "detail" property to show the compiler path in QuickPickItem.
// This property will be removed before writing the DebugConfiguration in launch.json.
newConfig.detail = task.detail ? task.detail : definition.command;
const isCl: boolean = compilerName === "cl.exe";
newConfig.cwd = isWindows && !isCl && !process.env.PATH?.includes(compilerPath) ? path.dirname(compilerPath) : "${workspaceFolder}";

return new Promise<vscode.DebugConfiguration>(resolve => {
if (platform === "darwin") {
Expand All @@ -201,7 +204,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
debuggerName = "gdb";
}

if (platform === "win32") {
if (isWindows) {
debuggerName += ".exe";
}

Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/cppBuildTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class CppBuildTaskProvider implements TaskProvider {
if (compilerArgs && compilerArgs.length > 0) {
args = args.concat(compilerArgs);
}
const cwd: string = isCl ? "${workspaceFolder}" : path.dirname(compilerPath);
const cwd: string = isWindows && !isCl && !process.env.PATH?.includes(compilerPath) ? path.dirname(compilerPath) : "${workspaceFolder}";
const options: cp.ExecOptions | undefined = { cwd: cwd };
definition = {
type: CppBuildTaskProvider.CppBuildScriptType,
Expand Down

0 comments on commit adf9959

Please sign in to comment.