Open History to see the last commit
1import * as ChildProcess from "node:child_process";
2
3export function fixPath(): void {
4 if (process.platform !== "darwin") return;
5
6 try {
7 const shell = process.env.SHELL ?? "/bin/zsh";
8 const result = ChildProcess.execFileSync(shell, ["-ilc", "echo -n $PATH"], {
9 encoding: "utf8",
10 timeout: 5000,
11 });
12 if (result) {
13 process.env.PATH = result;
14 }
15 } catch {
16 // Keep inherited PATH if shell lookup fails.
17 }
18}