Problem
Vite Tasks currently tries to parse commands statically (e.g. && lists) and otherwise falls back to running a shell (/bin/sh -c on Unix or cmd.exe /c on Windows).
However, many real-world tasks need:
- PowerShell on Windows,
- bash-specific features on Unix (vs
/bin/sh),
- or explicit “always run as script” mode (never try to split/parse).
Not being able to choose the interpreter makes scripts less portable and pushes authors to wrap everything manually.
Evidence (primary)
- Plan has a hard-coded fallback to
/bin/sh -c or cmd.exe /c.
Refs:
Proposed behavior (Unspecified syntax)
Add an optional per-task configuration, e.g.:
shell: "bash -c" or shell: ["powershell.exe","-NoLogo","-Command"]
and/or an execution mode:
mode: "auto" (current behavior),
mode: "shell" (always run as script via chosen shell),
mode: "spawn" (strict direct spawn; fail if not representable)
Use cases
- Windows repos standardizing on PowerShell scripts
- bash-only constructs (process substitution, arrays,
[[ ... ]], etc.)
- Avoiding accidental fallback when a task should be strictly spawnable
Backward compatibility
- Default remains current behavior (auto).
- Opt-in only changes behavior for tasks that specify
shell/mode.
Minimal implementation suggestion (MVP)
- Implement
shell override for the existing fallback pipeline first:
if shell is set, run the task command as one script in that shell (no splitting).
- Later iterations can decide whether/how to combine with
&& splitting and caching.
Problem
Vite Tasks currently tries to parse commands statically (e.g.
&&lists) and otherwise falls back to running a shell (/bin/sh -con Unix orcmd.exe /con Windows).However, many real-world tasks need:
/bin/sh),Not being able to choose the interpreter makes scripts less portable and pushes authors to wrap everything manually.
Evidence (primary)
/bin/sh -corcmd.exe /c.Refs:
Proposed behavior (Unspecified syntax)
Add an optional per-task configuration, e.g.:
shell: "bash -c"orshell: ["powershell.exe","-NoLogo","-Command"]and/or an execution mode:
mode: "auto"(current behavior),mode: "shell"(always run as script via chosen shell),mode: "spawn"(strict direct spawn; fail if not representable)Use cases
[[ ... ]], etc.)Backward compatibility
shell/mode.Minimal implementation suggestion (MVP)
shelloverride for the existing fallback pipeline first:if
shellis set, run the task command as one script in that shell (no splitting).&&splitting and caching.