Skip to content

fix(run): quote each argument of a multi-argument command - #622

Merged
not-matthias merged 1 commit into
mainfrom
cod-4230-codspeed-run-cmd-drops-argument-quoting-so-and-in
Nov 12, 2026
Merged

not-matthias merged 1 commit into
mainfrom
cod-4230-codspeed-run-cmd-drops-argument-quoting-so-and-in

Conversation

@not-matthias

Copy link
Copy Markdown
Member

Fixes COD-4230

Problem

codspeed run joined args.command with spaces and ran the result through a shell. Quoting removed by the user's shell was lost, so codspeed run -- cargo codspeed run 'a|b' ran cargo codspeed run a|b, piping into a command named b.

Change

  • One argument: kept as raw shell, so codspeed run -- "cmd1 && cmd2" behaves as before.
  • More than one argument: each is quoted with shell_words::join, so the command runs exactly as the user's shell parsed it.

codspeed exec is not affected: it passes argv to exec-harness as structured JSON, and its join(" ") only builds a log label.

Compatibility

Breaks callers who split shell syntax across several arguments, e.g. codspeed run -- cargo bench '&&' echo done. Those should pass one quoted string instead.

Tests

Unit tests cover single-string passthrough and quoting of plain args, |, &&, spaces, $ and single quotes.

Joining argv with spaces and running the result through a shell made `codspeed run -- cargo codspeed run 'a|b'` pipe into a command named `b`. Quote each argument when more than one is given. A single argument is still raw shell, so `codspeed run -- "cmd1 && cmd2"` is unchanged.
@not-matthias
not-matthias marked this pull request as ready for review November 12, 2026 11:52
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with the stated compatibility change.

Summary

codspeed run now quotes each argument when several arguments are supplied. A single argument still runs as raw shell text.

  • Multi-argument codspeed run commands keep shell characters inside their arguments.

Reviews (2) · Last reviewed commit: "fix(run): quote each argument of a multi..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 8 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 53 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing cod-4230-codspeed-run-cmd-drops-argument-quoting-so-and-in (ad57874) with main (21b0cda)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@lvaroqui lvaroqui 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.

LGTM!

@not-matthias
not-matthias merged commit b9cec4f into main Nov 12, 2026
69 checks passed
@not-matthias
not-matthias deleted the cod-4230-codspeed-run-cmd-drops-argument-quoting-so-and-in branch November 12, 2026 13:24
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.

2 participants