Commit graph

6 commits

Author SHA1 Message Date
Bob Badour
2a62643266 Add NinjaAndShellEscapeIncludingSpaces
Bug: 235333302

Test: m droid dist
Change-Id: Ic52fbdb64042148d851403b4afd2dd5392282f77
2022-06-21 11:10:16 -07:00
Colin Cross
97eda8939b Add NinjaAndshellEscapeListIncludingSpaces
Add a method that ninja and shell escapes each entry in a list
of strings as a single argument.

Test: escape_test.go
Change-Id: Iac05c64f1ae48cd6186f563790ea49b90618038d
2021-11-22 22:45:54 -08:00
Liz Kammer
3a988df18a Add ShellEscapeListIncludingSpaces
This simplifies escaping for aquery.

Test: build/bazel/ci/mixed_droid.sh
Change-Id: I88356a8eda0c6a6ac9426d37cd386f0a94b8818b
2021-11-16 17:17:02 -05:00
Jooyung Han
ddb5ed7e1f Add ShellEscapeIncludingSpaces(string)
ShellEscape(string) doesn't escape a string with spaces like "arg1
arg2". However, when we want to escape a string to use it as an
argument, then strings with spaces should be escaped.

For example,

  "command " + ShellEscapeIncludingSpaces("a b")

becomes "command 'a b'" so that "command" will get "a b" as a single
argument.

Bug: 182092664
Test: Added tests to escape_test.go
Change-Id: I8f88c18bc4f9f7aacfe9e701b8f0876dd8b9a8c3
2021-03-12 14:37:42 +09:00
Colin Cross
cc1ec0fedc Replace *Escape with *EscapeList
NinjaEscape and ShellEscape operated on lists, which led to
awkward NinjaEscape([]string{s})[0].  Replace NinjaEscape
and ShellEscape with NinjaEscapeList and ShellEscapeList,
and add new NinjaEscape and ShellEscape functions that
operate on a string.

Test: m checkbuild
Change-Id: I283d92cdddc8e0066a300015863a3eab66f77c23
2018-09-19 16:17:10 -07:00
Colin Cross
41ca49ff91 Add proptools functions to escape strings
Blueprint properties that end up as command line arguments need to be
both ninja and shell escaped.  Provide helpers that primary builders can
use to appropriately escape them.

Change-Id: Ifd697d87edb1c6f0a910377835c391bbe8f95b42
2016-09-29 14:31:40 -07:00