diff --git a/lib/base-compiler.js b/lib/base-compiler.js index 781ce6e6f..ec4973666 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -80,7 +80,7 @@ export class BaseCompiler { this.llvmIr = new LlvmIrParser(this.compilerProps); this.llvmAst = new LlvmAstParser(this.compilerProps); - this.formatHandler = new FormattingHandler(this.env.ceProps); + this.formatHandler = new FormattingHandler(this.env.ceProps, async job => await this.env.enqueue(job)); this.toolchainPath = getToolchainPath(this.compiler.exe, this.compiler.options); diff --git a/lib/handlers/formatting.js b/lib/handlers/formatting.js index bd64fadce..8acb49dc4 100644 --- a/lib/handlers/formatting.js +++ b/lib/handlers/formatting.js @@ -29,7 +29,8 @@ import { getFormatterTypeByKey } from '../formatters'; import { logger } from '../logger'; export class FormattingHandler { - constructor(ceProps) { + constructor(ceProps, maybeEnqueue) { + this.enqueue = maybeEnqueue || (async job => await job()); this.formatters = {}; this.ceProps = ceProps; const formatters = _.compact(ceProps('formatters', '').split(':')); @@ -49,7 +50,7 @@ export class FormattingHandler { const versionRe = this.ceProps(`formatter.${formatter}.versionRe`, '.*'); const hasExplicitVersion = this.ceProps(`formatter.${formatter}.explicitVersion`, '') !== ''; try { - const result = await exec.execute(exe, [versionArg], {}); + const result = await this.enqueue(async () => exec.execute(exe, [versionArg], {})); const match = result.stdout.match(versionRe); const formatterClass = getFormatterTypeByKey(type); const styleList = this.ceProps(`formatter.${formatter}.styles`);