1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 06:52:43 +01:00

Merge pull request #13065 from roberth/escapeShellArg

Rename `shellEscape` -> `escapeShellArgAlways`
This commit is contained in:
Robert Hensing 2025-04-23 23:35:15 +02:00 committed by GitHub
commit 8a1c40b927
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 25 additions and 20 deletions

View file

@ -112,7 +112,7 @@ std::string StructuredAttrs::writeShell(const nlohmann::json & json)
auto handleSimpleType = [](const nlohmann::json & value) -> std::optional<std::string> {
if (value.is_string())
return shellEscape(value.get<std::string_view>());
return escapeShellArgAlways(value.get<std::string_view>());
if (value.is_number()) {
auto f = value.get<float>();
@ -160,7 +160,7 @@ std::string StructuredAttrs::writeShell(const nlohmann::json & json)
for (auto & [key2, value2] : value.items()) {
auto s3 = handleSimpleType(value2);
if (!s3) { good = false; break; }
s2 += fmt("[%s]=%s ", shellEscape(key2), *s3);
s2 += fmt("[%s]=%s ", escapeShellArgAlways(key2), *s3);
}
if (good)