From 3dfb7c7fada1782afd6b1ddfd76635baf7740fcd Mon Sep 17 00:00:00 2001 From: Pascal Date: Mon, 3 Aug 2026 18:22:56 +0200 Subject: [PATCH] server: simplify get_info result handling Drop the named limits and the working directory error branch, keeping the probe result handling to a single expression. --- tools/server/server-tools.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/server/server-tools.cpp b/tools/server/server-tools.cpp index 1b3ec4dcac..984bb478ea 100644 --- a/tools/server/server-tools.cpp +++ b/tools/server/server-tools.cpp @@ -1094,9 +1094,6 @@ struct server_tool_get_datetime : server_tool { // get_info: returns runtime info (OS name/version and cwd) // -static constexpr size_t SERVER_TOOL_GET_INFO_MAX_OUTPUT = 4 * 1024; // 4 KB -static constexpr int SERVER_TOOL_GET_INFO_TIMEOUT = 5; // seconds - struct server_tool_get_info : server_tool { server_tool_get_info() { name = "get_info"; @@ -1122,9 +1119,9 @@ struct server_tool_get_info : server_tool { auto io = make_tools_io(params); #ifdef _WIN32 - auto res = io->run({"cmd", "/c", "ver"}, SERVER_TOOL_GET_INFO_MAX_OUTPUT, SERVER_TOOL_GET_INFO_TIMEOUT); + auto res = io->run({"cmd", "/c", "ver"}, 4096, 5); #else - auto res = io->run({"uname", "-a"}, SERVER_TOOL_GET_INFO_MAX_OUTPUT, SERVER_TOOL_GET_INFO_TIMEOUT); + auto res = io->run({"uname", "-a"}, 4096, 5); #endif // "ver" prints a blank line before the version, so the output is stripped on both ends; // a failed spawn or a timeout leaves a diagnostic in res.output, which is not an OS name @@ -1134,9 +1131,6 @@ struct server_tool_get_info : server_tool { if (cwd.empty()) { std::error_code ec; cwd = fs::current_path(ec).string(); - if (ec) { - cwd = "unknown"; - } } return {