fix(coding-agent): resolved symlinked paths before passing to brush
- Resolved symlinked paths before passing to brush shell to keep `pwd` output aligned with canonical Git worktree paths. - Added `resolveShellCwd` helper that safely resolves symlinks and falls back to original path on error. - Added test case verifying symlinked directories are canonicalized before execution.
This commit is contained in:
@@ -39,6 +39,20 @@ describe("executeBash", () => {
|
||||
expect(result.output.trim()).toBe(tempDir);
|
||||
});
|
||||
|
||||
it("canonicalizes symlinked cwd before execution", async () => {
|
||||
if (process.platform === "win32") {
|
||||
return;
|
||||
}
|
||||
|
||||
const realDir = path.join(tempDir, "real");
|
||||
const linkDir = path.join(tempDir, "link");
|
||||
fs.mkdirSync(realDir);
|
||||
fs.symlinkSync(realDir, linkDir, "dir");
|
||||
|
||||
const result = await executeBash("pwd", { cwd: linkDir, timeout: 5000 });
|
||||
expect(result.output.trim()).toBe(fs.realpathSync(linkDir));
|
||||
});
|
||||
|
||||
it("passes env vars", async () => {
|
||||
const result = await executeBash("echo $PI_TEST_ENV", {
|
||||
cwd: tempDir,
|
||||
|
||||
Reference in New Issue
Block a user