Merge pull request #16180 from zimbatm/shell-escaping
Escape all shell arguments uniformly
This commit is contained in:
+10
-1
@@ -209,7 +209,16 @@ rec {
|
||||
escapeShellArg "so([<>])me"
|
||||
=> "so\\(\\[\\<\\>\\]\\)me"
|
||||
*/
|
||||
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
|
||||
escapeShellArg = arg:
|
||||
lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]") (toString arg);
|
||||
|
||||
/* Escape all arguments to be passed to the Bourne shell.
|
||||
|
||||
Example:
|
||||
escapeShellArgs ["one" "two three"]
|
||||
=> "one two\\ three"
|
||||
*/
|
||||
escapeShellArgs = concatMapStringsSep " " escapeShellArg;
|
||||
|
||||
/* Obsolete - use replaceStrings instead. */
|
||||
replaceChars = builtins.replaceStrings or (
|
||||
|
||||
Reference in New Issue
Block a user