From 0c04c89f1d9288cdcbaa9da93b067924a416d55d Mon Sep 17 00:00:00 2001 From: Patrick Quist Date: Thu, 29 Dec 2022 19:23:20 +0100 Subject: [PATCH] Fixcrashissue (#4518) * 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. --- lib/base-compiler.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 8fb7914178d..3ad4cd3f66e 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -1447,9 +1447,9 @@ export class BaseCompiler implements ICompiler { } async buildExecutableInFolder(key, dirPath): Promise { - 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); @@ -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 { @@ -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); @@ -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,