From 7e1b84e83cc5a932341a598b7252714ffc92b705 Mon Sep 17 00:00:00 2001 From: shweet Date: Thu, 18 Dec 2025 00:25:28 -0500 Subject: [PATCH] :) --- src/render.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/render.cpp b/src/render.cpp index 845c17e..9912dc5 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "log.h" #include "process_.h" @@ -108,8 +109,23 @@ namespace anm2ed command += " 2>&1"; #if _WIN32 - command = "powershell -Command \"& { " + command + " | Tee-Object -FilePath " + string::quote(loggerPathString) + - " -Append }\""; + auto escape_double_quotes_for_cmd = [](const std::string& input) + { + std::string escaped{}; + escaped.reserve(input.size() * 2); + for (char character : input) + { + if (character == '"') + escaped += "\"\""; + else + escaped += character; + } + return escaped; + }; + + auto powershellScript = + std::string("& { & ") + command + " | Tee-Object -FilePath " + string::quote(loggerPathString) + " -Append }"; + command = "powershell -Command \"" + escape_double_quotes_for_cmd(powershellScript) + "\""; #else command += " | tee -a " + string::quote(loggerPathString); #endif