Skip to content

Commit 62ac866

Browse files
author
Elaheh Rashedi
authored
fail the tasks, if there is a fatal link error (#9211)
1 parent fc69d50 commit 62ac866

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Extension/src/LanguageServer/cppBuildTaskProvider.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,24 +430,26 @@ class CustomBuildTaskTerminal implements Pseudoterminal {
430430
this.writeEmitter.fire(localize("build.run.terminated", "Build run was terminated.") + this.endOfLine);
431431
resolve(-1);
432432
} else {
433-
resolve(0);
433+
resolve(result);
434434
}
435435
});
436436
}
437437
});
438-
let result: number = this.printBuildSummary(error, stdout, stderr);
439-
if (spawnResult === -1) {
440-
result = -1;
441-
}
438+
const result: number = this.printBuildSummary(error, stdout, stderr, spawnResult);
442439
this.closeEmitter.fire(result);
443440
} catch {
444441
this.closeEmitter.fire(-1);
445442
}
446443
}
447444

448-
private printBuildSummary(error: string, stdout: string, stderr: string): number {
445+
private printBuildSummary(error: string, stdout: string, stderr: string, spawnResult: number): number {
446+
if (spawnResult !== 0) {
447+
telemetry.logLanguageServerEvent("cppBuildTaskError");
448+
this.writeEmitter.fire(localize("build.finished.with.error", "Build finished with error(s).") + this.endOfLine);
449+
return -1;
450+
}
449451
if (error || (!stdout && stderr && stderr.includes("error")) ||
450-
(stdout && stdout.includes("error C"))) { // cl.exe compiler errors
452+
(stdout && (stdout.includes("error C") || stdout.includes("LINK : fatal error")))) { // cl.exe compiler errors
451453
telemetry.logLanguageServerEvent("cppBuildTaskError");
452454
this.writeEmitter.fire(localize("build.finished.with.error", "Build finished with error(s).") + this.endOfLine);
453455
return -1;

0 commit comments

Comments
 (0)