From ff871ec4f5594eb7e648d9d4bf412d4d31a1b5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 9 Oct 2024 01:23:01 +0800 Subject: [PATCH] u8 --- plugins/exec/PyStand.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/plugins/exec/PyStand.cpp b/plugins/exec/PyStand.cpp index 4bb01137..16238827 100644 --- a/plugins/exec/PyStand.cpp +++ b/plugins/exec/PyStand.cpp @@ -360,19 +360,18 @@ int main() } } #else + SetConsoleOutputCP(CP_UTF8); + auto getCurrentTimestamp = [] { - auto getCurrentTimestamp = [] - { - auto now = std::chrono::system_clock::now(); - std::time_t now_time_t = std::chrono::system_clock::to_time_t(now); - std::tm now_tm = *std::localtime(&now_time_t); - std::ostringstream oss; - oss << std::put_time(&now_tm, "log_%Y-%m-%d-%H-%M-%S.txt"); - return oss.str(); - }; - auto curr = getCurrentTimestamp(); - freopen(curr.c_str(), "a", stderr); - } + auto now = std::chrono::system_clock::now(); + std::time_t now_time_t = std::chrono::system_clock::to_time_t(now); + std::tm now_tm = *std::localtime(&now_time_t); + std::ostringstream oss; + oss << std::put_time(&now_tm, "log_%Y-%m-%d-%H-%M-%S.txt"); + return oss.str(); + }; + auto curr = getCurrentTimestamp(); + freopen(curr.c_str(), "a", stderr); #endif int hr = ps.RunString(init_script); return hr;