Fix PowerShell -Command argv binding so positional args + stdin work
PowerShell's -Command treats trailing argv entries as part of the
command-line text rather than as $args, so a hook with an inline
command and an arg template raised a parser error. Wrap inline commands
in a scriptblock with @args splat, and pipe $input into the block so
{{body.*}} arg templates AND stdin JSON both reach the script. Verified
end-to-end against ping, bearer (good/bad/missing), HMAC (good/bad/missing),
IP allowlist deny, async 202, and stdin+template combined.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,11 @@ public sealed class ProcessExecutor : IExecutor
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
psi.ArgumentList.Add("-Command");
|
psi.ArgumentList.Add("-Command");
|
||||||
psi.ArgumentList.Add(endpoint.InlineCommand ?? "");
|
// Pipe stdin into a scriptblock so trailing argv entries bind via @args
|
||||||
|
// and the script can still consume the request body via $input.
|
||||||
|
// Without the wrapper, PowerShell concatenates all trailing args into the
|
||||||
|
// -Command string and fails to parse them.
|
||||||
|
psi.ArgumentList.Add("$input | & { " + (endpoint.InlineCommand ?? "") + " } @args");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user