From c8bbdc4f54cd2ba661726c6f98f3285ace02881d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 14 Apr 2022 18:59:24 +0200 Subject: [PATCH] Get rid of the last uses of Boost.Process --- src/common/logging/common.cpp | 14 ++++++-------- src/common/process.cpp | 15 ++++++--------- src/wine-host/asio-fix.h | 1 - 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/common/logging/common.cpp b/src/common/logging/common.cpp index b68a1db9..5cedf62f 100644 --- a/src/common/logging/common.cpp +++ b/src/common/logging/common.cpp @@ -18,15 +18,12 @@ #include -#include #include #include #include #include #include -namespace bp = boost::process; - /** * The environment variable indicating whether to log to a file. Will log to * STDERR if not specified. @@ -60,11 +57,12 @@ Logger::Logger(std::shared_ptr stream, Logger Logger::create_from_environment(std::string prefix, std::shared_ptr stream, bool prefix_timestamp) { - bp::environment env = boost::this_process::environment(); - const std::string file_path = - env[logging_file_environment_variable].to_string(); - std::string verbosity = - env[logging_verbosity_environment_variable].to_string(); + // NOLINTNEXTLINE(concurrency-mt-unsafe) + const char* file_path_env = getenv(logging_file_environment_variable); + // NOLINTNEXTLINE(concurrency-mt-unsafe) + const char* verbosity_env = getenv(logging_verbosity_environment_variable); + std::string file_path = file_path_env ? std::string(file_path_env) : ""; + std::string verbosity = verbosity_env ? std::string(verbosity_env) : ""; // Editor debug tracing is an optional flag that can be added to any debug // level (and technically it will also work fine if it's the only option, diff --git a/src/common/process.cpp b/src/common/process.cpp index d8d79510..68bb1799 100644 --- a/src/common/process.cpp +++ b/src/common/process.cpp @@ -24,15 +24,12 @@ namespace fs = ghc::filesystem; bool pid_running(pid_t pid) { - // With regular individually hosted plugins we can simply check whether the - // process is still running, however Boost.Process does not allow you to do - // the same thing for a process that's not a direct child if this process. - // When using plugin groups we'll have to manually check whether the PID - // returned by the group host process is still active. We sadly can't use - // `kill()` for this as that provides no way to distinguish between active - // processes and zombies, and a terminated group host process will always be - // left as a zombie process. If the process is active, then - // `/proc//{cwd,exe,root}` will be valid symlinks. + // In theory you could `kill(0)` a process to check if it's still active, + // but that doesn't distinguish between actually running processes and + // unreaped zombies, and terminated group host processes will always be left + // as zombies since there may not be anything left to reap them. Instead + // we'll check whether one of `/proc//{cwd,exe,root}` are valid + // symlinks. std::error_code err; fs::canonical("/proc/" + std::to_string(pid) + "/exe", err); diff --git a/src/wine-host/asio-fix.h b/src/wine-host/asio-fix.h index e96424e4..a3689dbb 100644 --- a/src/wine-host/asio-fix.h +++ b/src/wine-host/asio-fix.h @@ -41,7 +41,6 @@ // FIXME: Remove Boost stuff #include #include -#include #include // #include // #include