Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
bounded_command.h File Reference

Capture a shell helper's output without an unbounded shutdown wait. More...

#include <array>
#include <cerrno>
#include <chrono>
#include <csignal>
#include <optional>
#include <shared_mutex>
#include <string>
#include <thread>
#include <fcntl.h>
#include <poll.h>
#include <sys/wait.h>
#include <unistd.h>
Include dependency graph for bounded_command.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::shared_mutex & platf::bounded_command::reap_mutex ()
std::optional< std::string > platf::bounded_command::output (const std::string &command, std::chrono::milliseconds timeout, bool *timed_out)

Detailed Description

Capture a shell helper's output without an unbounded shutdown wait.

Definition in file bounded_command.h.

Function Documentation

◆ output()

std::optional< std::string > platf::bounded_command::output ( const std::string & command,
std::chrono::milliseconds timeout,
bool * timed_out )
inline

Definition at line 33 of file bounded_command.h.

◆ reap_mutex()

std::shared_mutex & platf::bounded_command::reap_mutex ( )
inline

Held shared by every bounded command from before its fork until its child is reaped, and taken exclusively by proc_t::running() before it reaps stray children with waitpid(-1). Without it, that waitpid can take a command's exit status first: waitpid(child) then fails with ECHILD, and a complete reply is discarded as a failure.

Definition at line 28 of file bounded_command.h.