XS✔ ◾ Change Exec Interface from String to String Array#782
XS✔ ◾ Change Exec Interface from String to String Array#782muiriswoulfe merged 4 commits intomainfrom
Conversation
PR Metrics✔ Thanks for keeping your pull request small.
Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs! |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
There was a problem hiding this comment.
Pull request overview
This PR fixes argument tokenization issues in command execution by changing the runner execution contract from a single space-delimited string to a string[] passed end-to-end through the runner abstraction (GitHub Actions + Azure Pipelines). This aligns the internal interfaces with the underlying execution APIs and prevents incorrect splitting for arguments containing spaces.
Changes:
- Update runner exec APIs (
RunnerInvokerInterface,RunnerInvoker, GitHub/Azure runner invokers, and wrappers) to acceptargs: string[]. - Migrate key call sites (
GitInvoker,TokenManager) to construct argument arrays directly. - Update unit tests to pass/verify argument arrays (using
ts-mockitodeepEqual([...])where appropriate).
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/task/src/wrappers/gitHubRunnerWrapper.ts | Removes args.split(" "); passes string[] directly to @actions/exec. |
| src/task/src/wrappers/azurePipelinesRunnerWrapper.ts | Updates execSync wrapper signature to args: string[] and forwards to task-lib. |
| src/task/src/runners/runnerInvokerInterface.d.ts | Changes exec signature to (tool: string, args: string[]). |
| src/task/src/runners/runnerInvoker.ts | Forwards string[] args through the invoker selection layer. |
| src/task/src/runners/gitHubRunnerInvoker.ts | Updates exec signature and forwards arrays to the GitHub runner wrapper. |
| src/task/src/runners/azurePipelinesRunnerInvoker.ts | Updates exec signature and forwards arrays to the Azure runner wrapper. |
| src/task/src/repos/tokenManager.ts | Converts Azure CLI invocations from strings to argument arrays. |
| src/task/src/git/gitInvoker.ts | Converts git invocations to argument arrays; updates invokeGit to accept string[]. |
| src/task/tests/runners/runnerInvoker.spec.ts | Updates exec tests to use string[] args and deepEqual for matching. |
| src/task/tests/runners/gitHubRunnerInvoker.spec.ts | Updates wrapper expectations to match argument arrays via deepEqual. |
| src/task/tests/runners/azurePipelinesRunnerInvoker.spec.ts | Updates wrapper expectations to match argument arrays via deepEqual. |
| src/task/tests/repos/tokenManager.spec.ts | Updates mocked Azure CLI calls to match argument arrays via deepEqual. |
| src/task/tests/git/gitInvoker.spec.ts | Imports deepEqual and updates git exec expectations to argument arrays. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Summary
args.split(" ")ingitHubRunnerWrapper.exec()would incorrectly split arguments containing spaces (e.g., file paths or values with embedded spaces).execinterface fromargs: stringtoargs: string[]across the entire runner invoker chain, passing arrays directly to the underlying@actions/execandazure-pipelines-task-libAPIs.gitInvoker.ts,tokenManager.ts) and all corresponding test files to use string arrays.