fix(plan): skip cmd->ps1 rewrite when stdin is not a terminal#491
Merged
Conversation
The plan-time `.cmd` -> `powershell -File <.ps1>` rewrite was applied unconditionally on Windows. The npm/pnpm/yarn `.ps1` wrappers read stdin (`$MyInvocation.ExpectingInput` -> `$input | & node ...`) and block forever when stdin is a non-TTY pipe or null, as on CI runners: the build finishes but the wrapper never exits while draining stdin, holding the runner's stdio pipe open until the job is cancelled hours later. Gate the rewrite on `is_stdin_terminal()`, mirroring vite_command's ps1_shim. Without a terminal there is no Ctrl+C prompt to corrupt, so falling back to the `.cmd` (which never reads stdin) is strictly safer. Ref voidzero-dev/vite-plus#1489
The plan-time `.cmd` -> PowerShell rewrite is now gated on an interactive terminal (is_stdin_terminal). The snapshot test runner has no TTY on stdin, so the rewrite is skipped and the plan records the `node_modules/.bin` shim directly instead of `powershell -File ...vite.ps1`. Update both fixture snapshots and the fixture comment to match the gated behavior.
Both vite_task_plan::ps1_shim and vite-plus's vite_command::ps1_shim need the same cached stdin-TTY gate to decide whether to rewrite `.cmd` to PowerShell. Host it once in vite_powershell (alongside POWERSHELL_PREFIX, powershell_host, find_ps1_sibling) so both consumers share one implementation instead of duplicating it across the two repos.
fengmk2
added a commit
to voidzero-dev/vite-plus
that referenced
this pull request
Jun 28, 2026
voidzero-dev/vite-task#491 merged to main as 6cfa6e47. Point the rev there (was the branch commit 0068d09b) so it tracks a permanent commit on main.
fengmk2
added a commit
to voidzero-dev/vite-plus
that referenced
this pull request
Jun 28, 2026
voidzero-dev/vite-task#491 merged to main as 6cfa6e47. Point the rev there (was the branch commit 0068d09b) so it tracks a permanent commit on main.
fengmk2
added a commit
to voidzero-dev/vite-plus
that referenced
this pull request
Jun 28, 2026
) ## Problem vite-task's plan-time `.cmd` -> `.ps1` rewrite was ungated and hung Windows CI builds via `vp run <script>` (e.g. `vp run tauri build`): the `.ps1` wrappers block draining a non-TTY stdin pipe, so the process never exits after the build finishes and the runner waits on the open pipe until the job is cancelled hours later. ## Fix Bump vite-task to `fix/ps1-stdin-tty-gate`, which gates that rewrite on `is_stdin_terminal()` (matching `vite_command`'s ps1_shim). Rev `8daa9bb7` -> `0c5c6236`. Depends on voidzero-dev/vite-task#491 Closes #1971
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plan-time
.cmd->powershell -File <.ps1>rewrite (vite_task_plan::ps1_shim::rewrite_cmd_shim_with_args) was applied unconditionally on Windows. The npm/pnpm/yarn.ps1wrappers read stdin ($MyInvocation.ExpectingInput->$input | & node ...) and block forever when stdin is a non-TTY pipe or null, as on CI runners: the build finishes but the wrapper never exits while draining stdin, holding the runner's stdio pipe open until the job is cancelled hours later.This is the path
vp run <script>uses, so it hung even thoughvite_command's ownps1_shimis already gated. See tauri-apps/tauri-action#1308.Closes voidzero-dev/vite-plus#1971