fix: shell-args-parsing-bug
Summary
Resolves #6446
This fixes a standalone CLI shell-wrapper bug that left npm's -- sentinel in place when invoking shell -c -- <command>, which caused /bin/sh: --: invalid option during framework and function build steps. It normalizes shell arguments before dispatch and adds regression coverage for both argument parsing and Script_ShellJS execution.
Problem/Root Cause
The issue reports deploy and build failures from the standalone CLI path with commands shaped like .../runtime/shell -c -- <command>. The runtime wrapper stripped -c but did not also remove the sentinel that follows it, so the generated shell runtime could treat -- as the command to execute. That surfaces as /bin/sh: --: invalid option instead of running the intended npm or node command.
Solution/Changes
The shell argument cleanup is moved into a reusable normalizeShellScriptArgs helper in standalone/runtime.js. That helper removes -c and only strips the following -- when it is acting as npm's sentinel, while preserving other leading -- arguments and any arguments that follow the command string. The generated standalone shell.js now includes and uses the same helper, and the new regression tests cover both direct normalization behavior and the Script_ShellJS path that forks node commands after normalization.
Testing
- Added regression tests in
src/standalone/runtime.spec.tscoveringnormalizeShellScriptArgsandScript_ShellJS.