Skip to content

Commit f697086

Browse files
committed
keyfiles: read HOME at call time (Bun's homedir() keeps the startup value)
The keys test points HOME at a temp folder; under Bun, os.homedir() kept the real home, so defaultKeyFile ignored it and the test failed on every machine (CI's first run, and locally). Node's homedir() already reads HOME per call. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FUCJ3G7NDfAfSv3bCpekzF
1 parent 5ab8958 commit f697086

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/keyfiles.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ export interface KeyFileInfo {
5252
createdAt: string;
5353
}
5454

55+
/** The home folder as the environment says now (Node's homedir() does; Bun's keeps the value from startup). */
56+
const home = () => (process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME) || homedir();
57+
5558
export function defaultKeyFile(universeId: number, role: KeyRole): string {
56-
return join(homedir(), ".config", "typetorch", "keys", role === "main" ? `${universeId}.key` : `${universeId}.fallback.key`);
59+
return join(home(), ".config", "typetorch", "keys", role === "main" ? `${universeId}.key` : `${universeId}.fallback.key`);
5760
}
5861

5962
/** A key-path variable from the real environment only (not from an env file, not from a .env Bun loaded). */

0 commit comments

Comments
 (0)