From 5b9b4961d81c24c7fcbb254e012fdd020a42dc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 17 Apr 2017 16:48:33 +0200 Subject: [PATCH] helpers:shellquote: stringify argument fixes #34 --- helpers.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpers.lua b/helpers.lua index 3288e64..512b858 100644 --- a/helpers.lua +++ b/helpers.lua @@ -12,6 +12,7 @@ local pairs = pairs local rawget = rawget local require = require local tonumber = tonumber +local tostring = tostring local io = { open = io.open, popen = io.popen @@ -137,7 +138,8 @@ end -- }}} -- {{{ Escape a string for safe usage on the command line -function helpers.shellquote(s) +function helpers.shellquote(arg) + local s = tostring(arg) if s == nil then return "" end -- use single quotes, and put single quotes into double quotes -- the string $'b is then quoted as '$'"'"'b'"'"'