From f1871532cb9f6dfa7ba7ebc3712808635f75e9f1 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Wed, 19 Jun 2024 01:07:10 +0800 Subject: [PATCH] spec: create new environment --- spec.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/spec.ts b/spec.ts index 380d515..367692c 100644 --- a/spec.ts +++ b/spec.ts @@ -356,9 +356,12 @@ export function buildpath(specdir: string, bench: SPECBenchData): string { return path.join(benchmarkDir, 'build'); } -export function setenv(specdir: string): void { - process.env.SPEC = specdir; - process.env.PATH = `${path.join(specdir, 'bin')}${path.delimiter}${process.env.PATH}`; +export function getEnvironment(specdir: string): NodeJS.ProcessEnv { + return { + ...process.env, + SPEC: specdir, + PATH: `${path.join(specdir, 'bin')}${path.delimiter}${process.env.PATH}`, + }; } export interface SPEC { @@ -366,7 +369,7 @@ export interface SPEC { benchpath: (bench: SPECBenchData) => string; exepath: (bench: SPECBenchData) => string; buildpath: (bench: SPECBenchData) => string; - setenv: () => void; + getEnvironment: () => NodeJS.ProcessEnv; } export function mkSPEC(specRoot: string): SPEC { @@ -377,7 +380,7 @@ export function mkSPEC(specRoot: string): SPEC { benchpath: bench => benchpath(specRoot, bench), exepath: bench => exepath(specRoot, bench), buildpath: bench => buildpath(specRoot, bench), - setenv: () => setenv(specRoot), + getEnvironment: () => getEnvironment(specRoot), }; }