1// @effect-diagnostics nodeBuiltinImport:off - runs once at test setup, outside any Effect runtime.
2import * as NodeFS from "node:fs";
3import * as NodeOS from "node:os";
4import * as HostProcess from "../HostProcess.ts";
5
6// GitHub's Windows runners hand out the temp directory by its 8.3 short name
7// (C:\Users\RUNNER~1\...). Anything that canonicalises a path, such as git or
8// realpath, reports the long form, so equality checks between a temp path and
9// its canonical form fail. Node reads TEMP/TMP on every os.tmpdir() call, so
10// pointing them at the long form fixes every temp directory the suite makes.
11if (HostProcess.Platform.defaultValue() === "win32") {
12 try {
13 const longForm = NodeFS.realpathSync.native(NodeOS.tmpdir());
14 process.env.TEMP = longForm;
15 process.env.TMP = longForm;
16 } catch {
17 // Leave the host's value alone if it cannot be resolved.
18 }
19}