Skip to content

Commit ff5435f

Browse files
branchseerclaude
andcommitted
fix(e2e): inherit PATHEXT on Windows for executable lookup
When using native bash with env_clear(), the child process loses PATHEXT which is needed by the which crate to find executables with extensions like .exe and .cmd on Windows. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0266061 commit ff5435f

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stdin-passthrough",
33
"scripts": {
4-
"echo-stdin": "cat"
4+
"echo-stdin": "node -e \"process.stdin.pipe(process.stdout)\""
55
}
66
}

crates/vite_task_bin/tests/e2e_snapshots/fixtures/stdin-passthrough/snapshots/stdin passthrough to single task.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
3-
assertion_line: 166
3+
assertion_line: 203
44
expression: e2e_outputs
55
input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/stdin-passthrough
66
---
77
> vite run echo-stdin
8-
$ cat
8+
$ node -e "process.stdin.pipe(process.stdout)"
99
hello from stdin
1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -17,6 +17,6 @@ Performance: 0% cache hit rate
1717

1818
Task Details:
1919
────────────────────────────────────────────────
20-
[1] stdin-passthrough#echo-stdin: $ cat
20+
[1] stdin-passthrough#echo-stdin: $ node -e "process.stdin.pipe(process.stdout)"
2121
Cache miss: no previous cache entry found
2222
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

crates/vite_task_bin/tests/e2e_snapshots/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ fn run_case_inner(tmpdir: &AbsolutePath, fixture_path: &Path, fixture_name: &str
168168
.env("NO_COLOR", "1")
169169
.current_dir(e2e_stage_path.join(&e2e.cwd));
170170

171+
// On Windows, inherit PATHEXT for executable lookup
172+
if cfg!(windows) {
173+
if let Ok(pathext) = std::env::var("PATHEXT") {
174+
cmd.env("PATHEXT", pathext);
175+
}
176+
}
177+
171178
let output = if let Some(stdin_content) = step.stdin() {
172179
cmd.stdin(Stdio::piped());
173180
cmd.stdout(Stdio::piped());

0 commit comments

Comments
 (0)