diff --git a/backend/scripts/p11-acceptance.mjs b/backend/scripts/p11-acceptance.mjs index e5679de5..686a2c4f 100644 --- a/backend/scripts/p11-acceptance.mjs +++ b/backend/scripts/p11-acceptance.mjs @@ -845,6 +845,11 @@ async function setupContext({ repositoryRoot = defaultRepositoryRoot, env = proc export async function runIntegration({ repositoryRoot = defaultRepositoryRoot, keep = false, env = process.env, announce } = {}) { const ctx = await setupContext({ repositoryRoot, env }); + const priorEnv = {}; + for (const [key, value] of Object.entries(ctx.env)) { + priorEnv[key] = process.env[key]; + process.env[key] = value; + } let success = false; try { const checks = await productionChecks(ctx); @@ -864,6 +869,10 @@ export async function runIntegration({ repositoryRoot = defaultRepositoryRoot, k return { exitCode: success ? 0 : 1, runRoot: ctx.run.root, retained: !(await finalizeOwnedRun({ run: ctx.run, success, keep })) }; } finally { await stopBackend(ctx).catch(() => {}); + for (const [key, value] of Object.entries(ctx.env)) { + if (priorEnv[key] === undefined) delete process.env[key]; + else process.env[key] = priorEnv[key]; + } } }