Skip to content

Commit 5b9b496

Browse files
committed
helpers:shellquote: stringify argument
fixes #34
1 parent 941e502 commit 5b9b496

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

helpers.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local pairs = pairs
1212
local rawget = rawget
1313
local require = require
1414
local tonumber = tonumber
15+
local tostring = tostring
1516
local io = {
1617
open = io.open,
1718
popen = io.popen
@@ -137,7 +138,8 @@ end
137138
-- }}}
138139

139140
-- {{{ Escape a string for safe usage on the command line
140-
function helpers.shellquote(s)
141+
function helpers.shellquote(arg)
142+
local s = tostring(arg)
141143
if s == nil then return "" end
142144
-- use single quotes, and put single quotes into double quotes
143145
-- the string $'b is then quoted as '$'"'"'b'"'"'

0 commit comments

Comments
 (0)