diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-02 11:09:07 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-02 11:09:26 -0700 |
commit | afa3aa3d185f0f8b8cdb41832e97a2b8212f2339 (patch) | |
tree | fac76a843172e3cbcaa7c9f5deec7de54aaac4e6 /src/util.lisp | |
parent | 73c7683481de663df47a1422b7d0f012dbecfd8f (diff) | |
download | consfigurator-afa3aa3d185f0f8b8cdb41832e97a2b8212f2339.tar.gz |
ESCAPE-SH-{TOKEN,COMMAND}: also escape the empty string
This protects zero-length arguments to shell commands.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r-- | src/util.lisp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp index d9a6e2c..ab372ed 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -187,6 +187,14 @@ one-dimensional collections of values." (ensure-pathname (enough-pathname pathname chroot) :ensure-absolute t :defaults #P"/")) +(defun escape-sh-token (token &optional s) + "Like UIOP:ESCAPE-SH-TOKEN, but also escape the empty string." + (if (string= token "") (format s "\"\"") (uiop:escape-sh-token token s))) + +(defun escape-sh-command (token &optional s) + "Like UIOP:ESCAPE-SH-COMMAND, but also escape the empty string." + (uiop:escape-command token s 'escape-sh-token)) + ;;;; Progress & debug printing |