Skip to content

Only quote cmd batch strings where necessary

Arran Walker requested to merge ajwalker/fix-cmd-command-expansion into main

What does this MR do?

Two commits:

  • Slightly improves quoting by not relying on ReplaceAll() several times over the same string. The existing tests pass with all this, and there's good coverage here.
  • Modifies quoting to only quote strings where necessary. This fixes a bug in out test where we were quoting "echo". Because echo is a build-in command, if you quote it, it fails. This is unlike external commands, such as "git" that will work.

Why was this MR needed?

It fixes a test. It doesn't fix anything else, despite being a bug in the implementation, because this only affects the predefined scripts, and we have no predefined scripts that use this mode of quoting with a with a built-in command. We only had one test that did. But it's good to fix in case that was to ever change.

What's the best way to test this MR?

What are the relevant issue numbers?

#30835 (closed)

Edited by Arran Walker

Merge request reports