diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-11-19 11:52:08 +0100 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2013-11-19 11:52:08 +0100 |
commit | 722c03ae8b059cba8039e8066dd1a82e7c3ddcb3 (patch) | |
tree | f60559c092cbd671284ec6374739680c71e5eccb | |
parent | 384492772eef195831bb0e9726a48d871f166927 (diff) | |
download | luarocks-722c03ae8b059cba8039e8066dd1a82e7c3ddcb3.tar.gz luarocks-722c03ae8b059cba8039e8066dd1a82e7c3ddcb3.tar.bz2 luarocks-722c03ae8b059cba8039e8066dd1a82e7c3ddcb3.zip |
fixed double quotes in io.popen commands
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/fs/win32.lua | 9 | ||||
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 0280b3f0..9f85ac05 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -9,6 +9,15 @@ local cfg = require("luarocks.cfg") | |||
9 | local dir = require("luarocks.dir") | 9 | local dir = require("luarocks.dir") |
10 | local util = require("luarocks.util") | 10 | local util = require("luarocks.util") |
11 | 11 | ||
12 | -- Monkey patch io.popen and os.execute to make sure quoting | ||
13 | -- works as expected. | ||
14 | -- See http://lua-users.org/lists/lua-l/2013-11/msg00367.html | ||
15 | local _prefix = "type NUL && " | ||
16 | local _popen, _execute = io.popen, os.execute | ||
17 | io.popen = function(cmd, ...) return _popen(_prefix..cmd, ...) end | ||
18 | os.execute = function(cmd, ...) return _execute(_prefix..cmd, ...) end | ||
19 | |||
20 | |||
12 | --- Annotate command string for quiet execution. | 21 | --- Annotate command string for quiet execution. |
13 | -- @param cmd string: A command-line string. | 22 | -- @param cmd string: A command-line string. |
14 | -- @return string: The command-line, with silencing annotation. | 23 | -- @return string: The command-line, with silencing annotation. |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 1c0131c7..1d302288 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -357,7 +357,7 @@ local md5_cmd = { | |||
357 | function get_md5(file) | 357 | function get_md5(file) |
358 | local cmd = md5_cmd[cfg.md5checker] | 358 | local cmd = md5_cmd[cfg.md5checker] |
359 | if not cmd then return nil end | 359 | if not cmd then return nil end |
360 | local pipe = io.popen(cmd.." "..fs.absolute_name(file)) -- should be in fs.Q() | 360 | local pipe = io.popen(cmd.." "..fs.Q(fs.absolute_name(file))) |
361 | local computed = pipe:read("*a") | 361 | local computed = pipe:read("*a") |
362 | pipe:close() | 362 | pipe:close() |
363 | if computed then | 363 | if computed then |