diff options
author | Takase <20792268+takase1121@users.noreply.github.com> | 2024-06-22 22:52:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 10:52:51 -0400 |
commit | 45ff787c085adff0db824590476ea7274cbe6114 (patch) | |
tree | f228df4f04f576d1b15c5d350a3e84682f1c751d /src/lpm.lua | |
parent | d737011af25e7791b085df4e84edf9bd14ec9ce2 (diff) | |
download | lite-xl-plugin-manager-45ff787c085adff0db824590476ea7274cbe6114.tar.gz lite-xl-plugin-manager-45ff787c085adff0db824590476ea7274cbe6114.zip |
windows:fix argument escaping for cmd.exe (#117)
Diffstat (limited to 'src/lpm.lua')
-rw-r--r-- | src/lpm.lua | 4 |
1 files changed, 4 insertions, 0 deletions
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 |