mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(coding-agent): use physical temp paths in session-id-readonly test
On macOS tmpdir() is a symlink (/var -> /private/var) while the spawned CLI's process.cwd() is physical, so session cwd filtering never matched the fixtures and the fork-target rejection test failed locally.
This commit is contained in:
parent
a46f4e19f0
commit
afc2bd370e
1 changed files with 14 additions and 2 deletions
|
|
@ -1,5 +1,14 @@
|
|||
import { spawn } from "node:child_process";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import {
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readdirSync,
|
||||
readFileSync,
|
||||
realpathSync,
|
||||
rmSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
|
|
@ -15,7 +24,10 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
function createTempDir(): string {
|
||||
const dir = mkdtempSync(join(tmpdir(), "pi-session-id-readonly-"));
|
||||
// realpath: on macOS tmpdir() is a symlink (/var -> /private/var), but the
|
||||
// spawned CLI sees the physical path via process.cwd(). Session cwd
|
||||
// filtering compares paths textually, so the fixture must use physical paths.
|
||||
const dir = realpathSync(mkdtempSync(join(tmpdir(), "pi-session-id-readonly-")));
|
||||
tempDirs.push(dir);
|
||||
return dir;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue