mirror of
https://github.com/NixOS/nix
synced 2025-07-05 08:11:47 +02:00
Merge pull request #13065 from roberth/escapeShellArg
Rename `shellEscape` -> `escapeShellArgAlways`
This commit is contained in:
commit
8a1c40b927
6 changed files with 25 additions and 20 deletions
|
@ -152,8 +152,13 @@ std::string toLower(std::string s);
|
|||
|
||||
/**
|
||||
* Escape a string as a shell word.
|
||||
*
|
||||
* This always adds single quotes, even if escaping is not strictly necessary.
|
||||
* So both
|
||||
* - `"hello world"` -> `"'hello world'"`, which needs escaping because of the space
|
||||
* - `"echo"` -> `"'echo'"`, which doesn't need escaping
|
||||
*/
|
||||
std::string shellEscape(const std::string_view s);
|
||||
std::string escapeShellArgAlways(const std::string_view s);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -171,7 +171,7 @@ std::string toLower(std::string s)
|
|||
}
|
||||
|
||||
|
||||
std::string shellEscape(const std::string_view s)
|
||||
std::string escapeShellArgAlways(const std::string_view s)
|
||||
{
|
||||
std::string r;
|
||||
r.reserve(s.size() + 2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue