diff options
author | Matt Godbolt <matt@godbolt.org> | 2023-01-29 16:46:18 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-29 16:46:18 -0600 |
commit | 49d9a24552263af3ff5d7562cbc82b8afcbff8cb (patch) | |
tree | ba67bd13504e84a7e12a6955fe6816f7c187da85 /lib/compilers/hook.ts | |
parent | ac8f4445059830e22224e5034272f6931a943649 (diff) | |
download | compiler-explorer-49d9a24552263af3ff5d7562cbc82b8afcbff8cb.tar.gz compiler-explorer-49d9a24552263af3ff5d7562cbc82b8afcbff8cb.zip |
Fix up hoom_home for interpreting (#4651)gh-6039
Diffstat (limited to 'lib/compilers/hook.ts')
-rw-r--r-- | lib/compilers/hook.ts | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/compilers/hook.ts b/lib/compilers/hook.ts index 63cf6f8fc..12b826922 100644 --- a/lib/compilers/hook.ts +++ b/lib/compilers/hook.ts @@ -25,10 +25,20 @@ import path from 'path'; import {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces'; +import {CompilerInfo} from '../../types/compiler.interfaces'; +import {BasicExecutionResult, ExecutableExecutionOptions} from '../../types/execution/execution.interfaces'; import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces'; import {BaseCompiler} from '../base-compiler'; +import {CompilationEnvironment} from '../compilation-env'; export class HookCompiler extends BaseCompiler { + private readonly hook_home: string; + + constructor(compilerInfo: CompilerInfo & Record<string, any>, env: CompilationEnvironment) { + super(compilerInfo, env); + this.hook_home = path.resolve(path.join(path.dirname(this.compiler.exe), '..')); + } + static get key(): string { return 'hook'; } @@ -41,11 +51,13 @@ export class HookCompiler extends BaseCompiler { return path.join(dirPath, 'example.out'); } - override getDefaultExecOptions(): ExecutionOptions { - const execOptions = super.getDefaultExecOptions(); - const compilerPath = path.dirname(this.compiler.exe); - execOptions.env.HOOK_HOME = path.join(compilerPath, '..'); - return execOptions; + addHookHome(env: any) { + return {HOOK_HOME: this.hook_home, ...env}; + } + + override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> { + executeParameters.env = this.addHookHome(executeParameters.env); + return super.handleInterpreting(key, executeParameters); } override async runCompiler( |