Allow including process.h without Asio support

This commit is contained in:
Robbert van der Helm
2022-04-16 15:20:22 +02:00
parent e9c8c69a80
commit 6773305646
2 changed files with 10 additions and 2 deletions
+2
View File
@@ -256,6 +256,7 @@ Process::StatusResult Process::spawn_get_status() const {
}
}
#ifndef PROCESS_NO_ASIO
Process::HandleResult Process::spawn_child_piped(
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
asio::posix::stream_descriptor& stdout_pipe,
@@ -326,6 +327,7 @@ Process::HandleResult Process::spawn_child_piped(
return Handle(child_pid);
}
}
#endif // PROCESS_NO_ASIO
Process::HandleResult Process::spawn_child_redirected(
const ghc::filesystem::path& filename) const {
+8 -2
View File
@@ -22,13 +22,17 @@
#include <variant>
#include <vector>
#include <ghc/filesystem.hpp>
// We also use this header from the chainloaders, and we don't want to pull in
// Asio there
#ifndef PROCESS_NO_ASIO
#ifdef __WINE__
#include "../wine-host/asio-fix.h"
#endif
#include <unistd.h>
#include <asio/posix/stream_descriptor.hpp>
#include <ghc/filesystem.hpp>
#endif // PROCESS_NO_ASIO
// A minimal API akin to Boost.Process for launching and managing processes
// using plain Linux APIs. Needed so we can implement our chainloader without
@@ -225,6 +229,7 @@ class Process {
*/
StatusResult spawn_get_status() const;
#ifndef PROCESS_NO_ASIO
/**
* Spawn the process without waiting for its completion, leave STDIN alone,
* create pipes for STDOUT and STDERR, and assign those to the provided
@@ -235,6 +240,7 @@ class Process {
HandleResult spawn_child_piped(
asio::posix::stream_descriptor& stdout_pipe,
asio::posix::stream_descriptor& stderr_pipe) const;
#endif // PROCESS_NO_ASIO
/**
* Spawn the process without waiting for its completion, leave STDIN alone,