diff options
-rw-r--r-- | lib/default.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix index c1663a7b8..995e3dbcd 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -40,5 +40,12 @@ in #setToList = setMap (_: v: v); shell-escape = - stringAsChars (c: if c == "\n" then ''"${c}"'' else "\\${c}"); + let + isSafeChar = c: match "[-./0-9_a-zA-Z]" c != null; + in + stringAsChars (c: + if isSafeChar c then c + else if c == "\n" then "'\n'" + else "\\${c}"); + } |