From 8f94973cd899f43cc1f7ee09c29229a712cd2377 Mon Sep 17 00:00:00 2001 From: flightlessmango Date: Sun, 7 Jul 2024 00:45:11 +0200 Subject: [PATCH] exec: use prev ret if bad system call --- src/hud_elements.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp index 7e68c50..41e3f4e 100644 --- a/src/hud_elements.cpp +++ b/src/hud_elements.cpp @@ -1657,8 +1657,12 @@ void HudElements::update_exec(){ if (!HUDElements.shell) HUDElements.shell = std::make_unique(); - for(auto& item : exec_list) - item.ret = HUDElements.shell->exec(item.value + "\n"); + for(auto& item : exec_list){ + std::string ret = HUDElements.shell->exec(item.value + "\n"); + // use the previous ret if we get bad system call + if (ret.find("Bad system call") == std::string::npos) + item.ret = ret; + } #endif }