From 101c84cf59c5a66bef65e662c2fb3f8112afc02e Mon Sep 17 00:00:00 2001 From: Nuno Marques Date: Thu, 7 May 2026 16:37:54 -0700 Subject: [PATCH] fix(px4_daemon): annotate intentional empty catch in client cleanup bugprone-empty-catch flagged the std::system_error swallow around the detached stdin-relay thread. Spell out why the catch body is empty and add an explicit (void)0 statement so the intent is visible to both the linter and future readers: stdin forwarding is best-effort, and a failed thread spawn must not abort the client. Signed-off-by: Nuno Marques --- platforms/posix/src/px4/common/px4_daemon/client.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platforms/posix/src/px4/common/px4_daemon/client.cpp b/platforms/posix/src/px4/common/px4_daemon/client.cpp index 08b4dac515..b0a27c949c 100644 --- a/platforms/posix/src/px4/common/px4_daemon/client.cpp +++ b/platforms/posix/src/px4/common/px4_daemon/client.cpp @@ -225,7 +225,10 @@ Client::process_args(const int argc, const char **argv) std::thread(stdin_forward_loop, _fd).detach(); } catch (const std::system_error &) { - // Non-fatal: stdin relay was best-effort. + // intentionally swallowed: stdin relay is best-effort. If the OS cannot + // spawn the helper thread, interactive commands lose keystroke + // forwarding but the command itself still runs to completion. + (void)0; } return _listen();