feat: print error code when CreateProcessW fails

This commit is contained in:
Horror Proton
2023-01-28 21:52:02 +08:00
parent 193f526139
commit 77b6c1bd66
2 changed files with 4 additions and 2 deletions

View File

@@ -1386,7 +1386,8 @@ std::optional<int> asst::Controller::call_command_win32(const std::string& cmd,
BOOL create_ret =
CreateProcessW(nullptr, cmdline_osstr.data(), nullptr, nullptr, TRUE, 0, nullptr, nullptr, &si, &process_info);
if (!create_ret) {
Log.error("Call `", cmd, "` create process failed, ret", create_ret);
auto err = GetLastError();
Log.error("Call `", cmd, "` create process failed, ret", create_ret, "error code:", err);
return std::nullopt;
}