Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

exec: keep empty quoted arguments in a command line - #2577

Open
bardrop wants to merge 1 commit into
actions:mainfrom
bardrop-oss:fix-exec-empty-quoted-arg
Open

bardrop wants to merge 1 commit into
actions:mainfrom
bardrop-oss:fix-exec-empty-quoted-arg

Conversation

@bardrop

@bardrop bardrop commented Nov 12, 2026

Copy link
Copy Markdown

Fixes #2569.

When exec.exec / exec.getExecOutput get the command and its arguments in one commandLine string, argStringToArray:

  • dropped an empty quoted argument: ssh-keygen -N "" -f key ran as ssh-keygen -N -f key, so -f became the value of -N
  • trimmed the last argument, so whitespace inside quotes was lost: -m "fix typo " gave fix typo, while the same argument in the middle kept its space

Now an argument is kept once it has a quote, even if it is empty, and the last argument is only trimmed when it has no quotes. An unquoted last argument is still trimmed as before (for example a trailing newline in cmd arg\n), so that behavior does not change.

Tests: new argStringToArray unit tests for normal splitting, "" (alone, in the middle, twice), whitespace inside quotes at the end, and the unquoted trim. The "" and trailing-space cases fail on main. jest packages/exec packages/io --testTimeout 70000 passes (86), and eslint and prettier are clean.

argStringToArray dropped "" (so `ssh-keygen -N "" -f key` ran as
`ssh-keygen -N -f key`) and trimmed whitespace that was inside quotes
in the last argument. Keep an argument once it has a quote, and only
trim the last argument when it has no quotes.

Fixes actions#2569
@bardrop
bardrop requested a review from a team as a code owner November 12, 2026 08:18
Copilot AI balanced review requested due to automatic review settings November 12, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@bardrop

bardrop commented Nov 20, 2026

Copy link
Copy Markdown
Author

Friendly ping when you have time. Is there anything you'd like changed here?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@actions/exec: exec(commandLine) drops "" arguments and trims trailing spaces of the last argument

2 participants