Repository navigation
Activated pwsh loses the -- in mise exec -- cmd #13196
Replies: 1 comment
|
Thanks — this is an unusually good report, and every part of the mechanism checks out. Fix in #13202. I reproduced it on pwsh 7.6.6 on Linux as well, so it isn't Windows-specific at all: it's a property of PowerShell's function parameter binder wherever it runs. Your minimal repro holds exactly, including the "exactly one, wherever it sits" behavior: Worth adding: an alias to the native executable forwards One correction to your Scope section: The fix. The raw invocation text still holds the separator, so the wrapper now parses One consequence you'll care about, given you named it: Existing PowerShell sessions keep the old wrapper until AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.270. |
Uh oh!
There was an error while loading. Please reload this page.
In an activated PowerShell session,
mise exec -- pnpm --versionfails:The same command through the binary returns
11.25.0.Cause
mise activate pwshdefinesmiseas a function, and PowerShell's parameter binder claims the first bare--on a line as its own end-of-parameters token. It removes the token before$argsis populated, so the function forwardsexec pnpm --versionand clap reads--versionas mise's own.The binder does this to any function, with no mise involved:
It takes exactly one, wherever it sits:
f a b -- c -- dgivesa|b|c|--|d. No spelling of the function signature avoids it, and$args,[Parameter(ValueFromRemainingArguments)]andPositionalBinding=$falselose it identically. bash, zsh and fish forward"$@"untouched, which is why a single--is all the docs mention.Scope
Every command that takes a trailing
--is affected, includingmise exec,mise xandmise run.The failure needs nothing unusual to reproduce. It survives
-NoProfile, everyMISE_*and__MISE_*variable being cleared, and the activation script being generated fresh in the session rather than cached. It appears on Windows PowerShell 5.1.26100.8875 as well as pwsh 7.6.5.It also fails quietly until it doesn't: the separator only matters once the command being run has a flag colliding with one of mise's own, so
mise exec -- pnpm installworks andmise exec -- pnpm --versiondoes not.Spellings that do work
mise exec '--' pnpm --versionsucceeds, because quoting defeats the binder's token recognition. So doesmise.exe exec -- pnpm --version, which skips the function.mise exec -- -- pnpm --versionsucceeds too, and is worth naming because it is what people arrive at on their own: the first--dies in the binder and the second reaches clap. It is not portable. Outside an activated shell there is no function, both separators reach clap, and it fails withcannot find binary path. A script carrying the doubled form runs only where a profile happened to have activated mise.Environment
All reactions