From 6f587520d4e3a6e982563ce652518b5d0bd35a9e Mon Sep 17 00:00:00 2001 From: bryanthaboi Date: Wed, 26 Aug 2026 17:15:56 -0400 Subject: [PATCH] Update HostShell.lua --- src/core/HostShell.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/HostShell.lua b/src/core/HostShell.lua index be287beb..f7e5daff 100644 --- a/src/core/HostShell.lua +++ b/src/core/HostShell.lua @@ -197,8 +197,9 @@ function HostShell.popen(command, mode, opts) prefix = opts.envPrefix end local pipe + local line = HostShell.shellCommand(prefix .. command) withPopenLock(function() - local ok, p = pcall(io.popen, prefix .. command, mode or "r") + local ok, p = pcall(io.popen, line, mode or "r") pipe = (ok and p) or nil end) return pipe @@ -363,6 +364,18 @@ local function fetchError(url, status, noise) return ("fetch failed for %s: %s"):format(url, why) end +function HostShell.isWindows() + return (love and love.system and love.system.getOS + and love.system.getOS() == "Windows") or false +end + +function HostShell.shellCommand(command) + command = tostring(command) + if not HostShell.isWindows() then return command end + if command:sub(1, 1) ~= '"' then return command end + return '"' .. command .. '"' +end + -- Shell quoting for one curl argument; cmd.exe has no single-quote form. function HostShell.quote(s) s = tostring(s)