Save the daemon dir into its own state var, not an env var

This commit is contained in:
Graham Christensen 2024-05-07 09:39:16 -04:00
parent cddf736ff4
commit 7a12393ae8

View file

@ -10,7 +10,7 @@ import * as os from "node:os";
import * as path from "node:path"; import * as path from "node:path";
import { inspect, promisify } from "node:util"; import { inspect, promisify } from "node:util";
const ENV_CACHE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR"; const STATE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR";
const STATE_STARTED = "MAGIC_NIX_CACHE_STARTED"; const STATE_STARTED = "MAGIC_NIX_CACHE_STARTED";
const STARTED_HINT = "true"; const STARTED_HINT = "true";
@ -47,12 +47,12 @@ class MagicNixCacheAction {
this.daemonStarted = actionsCore.getState(STATE_STARTED) === STARTED_HINT; this.daemonStarted = actionsCore.getState(STATE_STARTED) === STARTED_HINT;
if (process.env[ENV_CACHE_DAEMONDIR]) { if (actionsCore.getState(STATE_DAEMONDIR) !== "") {
this.daemonDir = process.env[ENV_CACHE_DAEMONDIR]; this.daemonDir = actionsCore.getState(STATE_DAEMONDIR);
} else { } else {
this.daemonDir = this.idslib.getTemporaryName(); this.daemonDir = this.idslib.getTemporaryName();
mkdirSync(this.daemonDir); mkdirSync(this.daemonDir);
actionsCore.exportVariable(ENV_CACHE_DAEMONDIR, this.daemonDir); actionsCore.saveState(STATE_DAEMONDIR, this.daemonDir);
} }
this.idslib.stapleFile( this.idslib.stapleFile(