From 4e140f10d156bda264e80f3c4aba53a8399fffb5 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Fri, 17 Jan 2025 14:18:19 -0500 Subject: [PATCH] lib/dtutils/system - fixed Lua escaping in windows_command() --- lib/dtutils/system.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/dtutils/system.lua b/lib/dtutils/system.lua index f7db561..10ea29f 100644 --- a/lib/dtutils/system.lua +++ b/lib/dtutils/system.lua @@ -86,14 +86,13 @@ function dtutils_system.windows_command(command) local file = io.open(fname, "w") if file then dt.print_log("opened file") - command = string.gsub(command, "%%", "%%%%") -- escape % from windows shell file:write("@echo off\n") file:write('for /f "tokens=2 delims=:." %%x in (\'chcp\') do set cp=%%x\n') file:write("chcp 65001>nul\n") -- change the encoding of the terminal to handle non-english characters in path file:write("\n") file:write(command .. "\n") file:write("\n") - file:write("chcp %%cp%%>nul\n") + file:write("chcp %cp%>nul\n") file:close() result = dt.control.execute(fname)