Skip to content

Commit 732a716

Browse files
return configure fail output when build tries to configure first (#4536)
* return configure fail output when build tries to configure first * fix linter issue
1 parent f4af0e0 commit 732a716

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/cmakeProject.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,19 +1961,19 @@ export class CMakeProject {
19611961
return needsReconfigure;
19621962
}
19631963

1964-
async ensureConfigured(): Promise<number | null> {
1964+
async ensureConfigured(cancellationToken?: vscode.CancellationToken): Promise<CommandResult | null> {
19651965
const drv = await this.getCMakeDriverInstance();
19661966
if (!drv) {
19671967
return null;
19681968
}
19691969
// First, save open files
19701970
if (!await this.maybeAutoSaveAll()) {
1971-
return -1;
1971+
return { exitCode: -1 };
19721972
}
19731973
if (await this.needsReconfigure()) {
1974-
return (await this.configureInternal(ConfigureTrigger.compilation, [], ConfigureType.Normal)).exitCode;
1974+
return this.configureInternal(ConfigureTrigger.compilation, [], ConfigureType.Normal, undefined, cancellationToken);
19751975
} else {
1976-
return 0;
1976+
return { exitCode: 0 };
19771977
}
19781978
}
19791979

@@ -2065,12 +2065,14 @@ export class CMakeProject {
20652065
};
20662066
}
20672067

2068-
const configResult = await this.ensureConfigured();
2068+
const configResult = await this.ensureConfigured(cancellationToken);
20692069
if (configResult === null) {
20702070
throw new Error(localize('unable.to.configure', 'Build failed: Unable to configure the project'));
2071-
} else if (configResult !== 0) {
2071+
} else if (configResult.exitCode !== 0) {
20722072
return {
2073-
exitCode: configResult
2073+
exitCode: configResult.exitCode,
2074+
stdout: configResult.stdout,
2075+
stderr: configResult.stderr
20742076
};
20752077
}
20762078
drv = await this.getCMakeDriverInstance();
@@ -2182,7 +2184,7 @@ export class CMakeProject {
21822184
*/
21832185
async tryCompileFile(filePath: string): Promise<vscode.Terminal | null> {
21842186
const configResult = await this.ensureConfigured();
2185-
if (configResult === null || configResult !== 0) {
2187+
if (configResult === null || configResult.exitCode !== 0) {
21862188
// Config failed?
21872189
return null;
21882190
}

0 commit comments

Comments
 (0)