summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/shell.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/shell.nix b/lib/shell.nix
index f9779028e..5be8d6759 100644
--- a/lib/shell.nix
+++ b/lib/shell.nix
@@ -7,10 +7,13 @@ rec {
let
isSafeChar = testString "[-+./0-9:=A-Z_a-z]";
in
- stringAsChars (c:
- if isSafeChar c then c
- else if c == "\n" then "'\n'"
- else "\\${c}");
+ x:
+ if x == "" then "''"
+ else stringAsChars (c:
+ if isSafeChar c then c
+ else if c == "\n" then "'\n'"
+ else "\\${c}"
+ ) x;
#
# shell script generators