From 677330564689259a8982b098561f5b55c970a0f8 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 16 Apr 2022 15:20:22 +0200 Subject: [PATCH] Allow including process.h without Asio support --- src/common/process.cpp | 2 ++ src/common/process.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/process.cpp b/src/common/process.cpp index 234d002e..4094aa17 100644 --- a/src/common/process.cpp +++ b/src/common/process.cpp @@ -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 { diff --git a/src/common/process.h b/src/common/process.h index 092912a2..1d9a0726 100644 --- a/src/common/process.h +++ b/src/common/process.h @@ -22,13 +22,17 @@ #include #include +#include + +// 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 #include -#include +#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,