feat(tools): add an execute() overload with a deadline

- a child process that hangs blocked execute() until the caller was
  killed (e.g. by the ctest timeout); the child then ran on as an
  orphan, with its shm segments and ipc files
- the new overload kills the child with SIGKILL after the timeout and
  logs the timeout in the captured output
- keep the old overload (no limit) for compatibility

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-03 14:17:36 +00:00
committed by Dennis Klein
parent 3c752937a4
commit f50b1f0e39
2 changed files with 43 additions and 14 deletions

View File

@@ -9,6 +9,7 @@
#ifndef FAIR_MQ_TOOLS_PROCESS_H
#define FAIR_MQ_TOOLS_PROCESS_H
#include <chrono>
#include <string>
namespace fair::mq::tools
@@ -37,6 +38,16 @@ execute_result execute(const std::string& cmd,
const std::string& input = "",
int sig = -1);
/**
* Same as above, but kill the child process (SIGKILL) if it runs longer than
* timeout. A timeout of zero means no limit.
*/
execute_result execute(const std::string& cmd,
const std::string& prefix,
const std::string& input,
int sig,
std::chrono::milliseconds timeout);
} // namespace fair::mq::tools
#endif /* FAIR_MQ_TOOLS_PROCESS_H */