Commit 5c740fb7785ba63964ceb2dcbb23bd6ba2c2a064

Thomas de Grivel 2020-03-10T18:05:11

fix sh-quote for multiline values

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/shell/shell.lisp b/shell/shell.lisp
index edbe68f..135f272 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -74,7 +74,9 @@ Error: ~S"
 
 (defun sh-quote (&rest str)
   (let ((str (str str)))
-    (if (cl-ppcre:scan "^[-+/=.,:^_0-9A-Za-z]*$" str)
+    (declare (type string str))
+    (if (and (not (position #\Newline str))
+             (cl-ppcre:scan "^[-+/=.,:^_0-9A-Za-z]*$" str))
         str
         (str #\" (re-subst "([$`\\\\\"])" "\\\\\\1" str) #\"))))