#include "./fuzztest/internal/subprocess.h"
#include <cerrno>
#include <csignal>
#include <cstdlib>
#include <cstring>
#include <variant>
#if !defined(_MSC_VER)
#include <fcntl.h>
#include <poll.h>
#include <spawn.h>
#include <sys/wait.h>
#include <unistd.h>
#endif
#include <future>
#include <string>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/strings/str_cat.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "./fuzztest/internal/logging.h"
namespace fuzztest::internal {
#if !defined(_MSC_VER) && !(defined(__ANDROID_MIN_SDK_VERSION__) && \
__ANDROID_MIN_SDK_VERSION__ < 28)
TerminationStatus::TerminationStatus(int status) : … { … }
bool TerminationStatus::Exited() const { … }
bool TerminationStatus::Signaled() const { … }
std::variant<ExitCodeT, SignalT> TerminationStatus::Status() const { … }
class SubProcess { … };
void SubProcess::CreatePipes() { … }
void SubProcess::CloseChildPipes() { … }
void SubProcess::CloseParentPipes() { … }
posix_spawn_file_actions_t SubProcess::CreateChildFileActions() { … }
pid_t SubProcess::StartChild(
const std::vector<std::string>& command_line,
const absl::flat_hash_map<std::string, std::string>& environment) { … }
static bool ShouldRetry(int e) { … }
void SubProcess::ReadChildOutput(std::string* stdout_output,
std::string* stderr_output) { … }
namespace {
int Wait(pid_t pid) { … }
int WaitWithTimeout(pid_t pid, absl::Duration timeout) { … }
}
RunResults SubProcess::Run(
const std::vector<std::string>& command_line,
const absl::flat_hash_map<std::string, std::string>& environment,
absl::Duration timeout) { … }
#endif
RunResults RunCommand(
const std::vector<std::string>& command_line,
const absl::flat_hash_map<std::string, std::string>& environment,
absl::Duration timeout) { … }
}