From 45ff787c085adff0db824590476ea7274cbe6114 Mon Sep 17 00:00:00 2001 From: Takase <20792268+takase1121@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:52:51 +0800 Subject: windows:fix argument escaping for cmd.exe (#117) --- src/lpm.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lpm.lua b/src/lpm.lua index 98be79c..eb28afb 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1526,6 +1526,10 @@ function Bottle:run(args) local path = not self.is_system and (self.local_path .. PATHSEP .. "lite-xl" .. EXECUTABLE_EXTENSION) or self.lite_xl:get_binary_path() if not system.stat(path) then error("cannot find bottle executable " .. path) end local line = path .. (#args > 0 and " " or "") .. table.concat(common.map(args, function(arg) + if PLATFORM == "windows" then + -- windows uses " for quotes and needs doubling quotes for escaping them + return '"' .. arg:gsub('"+', function(s) return s..s end) .. '"' + end return "'" .. arg:gsub("'", "'\"'\"'"):gsub("\\", "\\\\") .. "'" end), " ") if VERBOSE then log.action("Running " .. line) end -- cgit v1.2.3