Skip to content

Commit 09dfd67

Browse files
committed
style(ps1_shim): tighten scope-rationale doc and unshadow ps1_str in test
Two minor cleanups from review: - Merge the two-sentence "outside `$VP_HOME` is left alone" paragraph into one that focuses on the WHY (avoid silently changing execution semantics for unrelated commands; respect locked-down hosts) instead of restating the trade-off as status-quo prose. - Rename the second `ps1_str` binding in the inside-vp-home test to `ps1_path` so the `PathBuf` and the `&str` derived from it have distinct names.
1 parent 3c50b5a commit 09dfd67

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

crates/vite_command/src/ps1_shim.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
//! pnpm/yarn/bun).
1515
//!
1616
//! Anything outside `$VP_HOME` — system tools, globally-installed npm
17-
//! shims, third-party CLIs whose `.cmd` and `.ps1` wrappers may not be
18-
//! semantically equivalent, hosts that intentionally block unsigned
19-
//! `.ps1` execution — is left alone. Stricter scoping means the prior
20-
//! `.cmd` path still runs there, but that matches the pre-fix status quo
21-
//! and avoids broadening execution semantics for unrelated commands.
17+
//! shims, third-party CLIs whose `.cmd` and `.ps1` wrappers may diverge —
18+
//! keeps its existing `.cmd` path (Ctrl+C corruption included), so we
19+
//! don't silently change execution semantics for unrelated commands or
20+
//! bypass execution policies on locked-down hosts.
2221
//!
2322
//! The task-layer rewrite (`vite_task_plan::ps1_shim`) is scoped
2423
//! differently — to `node_modules/.bin/*.cmd` inside the workspace — and
@@ -128,8 +127,8 @@ mod tests {
128127

129128
assert_eq!(program.as_path(), host.as_path());
130129
let as_strs: Vec<&str> = prefix_args.iter().filter_map(|a| a.to_str()).collect();
131-
let ps1_str = bin_dir.join("npm.ps1");
132-
let ps1_str = ps1_str.to_str().unwrap();
130+
let ps1_path = bin_dir.join("npm.ps1");
131+
let ps1_str = ps1_path.to_str().unwrap();
133132
assert_eq!(
134133
as_strs,
135134
vec!["-NoProfile", "-NoLogo", "-ExecutionPolicy", "Bypass", "-File", ps1_str]

0 commit comments

Comments
 (0)