Skip to content

Commit 744915e

Browse files
fix: avoid trailing colon in PATH when env.PATH is undefined
Prevents CWD from being added as an implicit executable search directory in minimal environments.
1 parent 0d99c0a commit 744915e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/commands/local/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function augmentPathForNode(
8989
const sep = process.platform === "win32" ? ";" : ":";
9090
return {
9191
...env,
92-
PATH: `${binDir}${sep}${env.PATH ?? ""}`,
92+
PATH: env.PATH ? `${binDir}${sep}${env.PATH}` : binDir,
9393
};
9494
}
9595

src/lib/init/verify-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export async function verifySetup(
7777
const sep = process.platform === "win32" ? ";" : ":";
7878
childEnv = {
7979
...childEnv,
80-
PATH: `${binDir}${sep}${childEnv.PATH ?? ""}`,
80+
PATH: childEnv.PATH ? `${binDir}${sep}${childEnv.PATH}` : binDir,
8181
};
8282
}
8383

0 commit comments

Comments
 (0)