continue mgmt portal

This commit is contained in:
Scott E. Graves 2025-03-01 07:26:38 -06:00
parent d54ba8203a
commit 1d78ee88b8

View File

@ -88,7 +88,6 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
lines.erase(lines.begin()); lines.erase(lines.begin());
auto result = nlohmann::json::parse(utils::string::join(lines, '\n')); auto result = nlohmann::json::parse(utils::string::join(lines, '\n'));
fmt::println("{}", result.dump());
res.set_content(result.dump(), "application/json"); res.set_content(result.dump(), "application/json");
res.status = http_error_codes::ok; res.status = http_error_codes::ok;
}); });
@ -124,7 +123,6 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
process_dir("s3"); process_dir("s3");
process_dir("sia"); process_dir("sia");
fmt::println("{}", result.dump());
res.set_content(result.dump(), "application/json"); res.set_content(result.dump(), "application/json");
res.status = http_error_codes::ok; res.status = http_error_codes::ok;
}); });
@ -186,7 +184,6 @@ auto handlers::read_process(provider_type type, std::string_view name,
} }
auto cmd_line = fmt::format("repertory {} {}", str_type, command); auto cmd_line = fmt::format("repertory {} {}", str_type, command);
fmt::println("{}", cmd_line);
auto *pipe = popen(cmd_line.c_str(), "r"); auto *pipe = popen(cmd_line.c_str(), "r");
if (pipe == nullptr) { if (pipe == nullptr) {
@ -196,11 +193,8 @@ auto handlers::read_process(provider_type type, std::string_view name,
std::string data; std::string data;
std::array<char, 1024U> buffer{}; std::array<char, 1024U> buffer{};
while (feof(pipe) == 0) { while (feof(pipe) == 0) {
auto *str = fgets(buffer.data(), buffer.size(), pipe); while (fgets(buffer.data(), buffer.size(), pipe) != nullptr) {
if (str != nullptr) { data += buffer.data();
data.insert(data.end(), buffer.begin(),
std::next(buffer.begin(), static_cast<std::int64_t>(
strnlen(str, buffer.size()))));
} }
} }
pclose(pipe); pclose(pipe);