Skip to content

Commit

Permalink
Fixcrashissue (#4518)
Browse files Browse the repository at this point in the history
* await for conan downloads
* await later

This fixes #4512 - essentially any exceptions thrown before the `await` of the build environment would leave a "task" that was trying to write to the temp dir. the temp dir would then be deleted, and the untar would fail, and as nobody was await-ing its return (as the awaits used to be _after_ the throwing code) then we'd get an uncaught exception.
  • Loading branch information
partouf authored and mattgodbolt committed Jan 24, 2023
1 parent 2356b02 commit 0c04c89
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/base-compiler.ts
Expand Up @@ -1447,9 +1447,9 @@ export class BaseCompiler implements ICompiler {
}

async buildExecutableInFolder(key, dirPath): Promise<BuildResult> {
const buildEnvironment = this.setupBuildEnvironment(key, dirPath, true);

const writeSummary = await this.writeAllFiles(dirPath, key.source, key.files, key.filters);
const downloads = await this.setupBuildEnvironment(key, dirPath, true);

const inputFilename = writeSummary.inputFilename;

const outputFilename = this.getExecutableFilename(dirPath, this.outputFilebase, key);
Expand All @@ -1472,7 +1472,6 @@ export class BaseCompiler implements ICompiler {
const execOptions = this.getDefaultExecOptions();
execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths(key.libraries);

const downloads = await buildEnvironment;
const result = await this.buildExecutable(key.compiler.exe, compilerArguments, inputFilename, execOptions);

return {
Expand Down Expand Up @@ -1714,8 +1713,6 @@ export class BaseCompiler implements ICompiler {
}

async doCompilation(inputFilename, dirPath, key, options, filters, backendOptions, libraries, tools) {
const buildEnvironment = this.setupBuildEnvironment(key, dirPath, filters.binary);

const inputFilenameSafe = this.filename(inputFilename);

const outputFilename = this.getOutputFilename(dirPath, this.outputFilebase, key);
Expand All @@ -1742,7 +1739,7 @@ export class BaseCompiler implements ICompiler {
const makeGccDump =
backendOptions.produceGccDump && backendOptions.produceGccDump.opened && this.compiler.supportsGccDump;

const downloads = await buildEnvironment;
const downloads = await this.setupBuildEnvironment(key, dirPath, filters.binary);
const [
asmResult,
astResult,
Expand Down

0 comments on commit 0c04c89

Please sign in to comment.