Get rid of the last uses of Boost.Process

This commit is contained in:
Robbert van der Helm
2022-04-14 18:59:24 +02:00
parent 0c0b26c9a1
commit c8bbdc4f54
3 changed files with 12 additions and 18 deletions
+6 -8
View File
@@ -18,15 +18,12 @@
#include <vestige/aeffectx.h> #include <vestige/aeffectx.h>
#include <boost/process/environment.hpp>
#include <chrono> #include <chrono>
#include <ctime> #include <ctime>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
namespace bp = boost::process;
/** /**
* The environment variable indicating whether to log to a file. Will log to * The environment variable indicating whether to log to a file. Will log to
* STDERR if not specified. * STDERR if not specified.
@@ -60,11 +57,12 @@ Logger::Logger(std::shared_ptr<std::ostream> stream,
Logger Logger::create_from_environment(std::string prefix, Logger Logger::create_from_environment(std::string prefix,
std::shared_ptr<std::ostream> stream, std::shared_ptr<std::ostream> stream,
bool prefix_timestamp) { bool prefix_timestamp) {
bp::environment env = boost::this_process::environment(); // NOLINTNEXTLINE(concurrency-mt-unsafe)
const std::string file_path = const char* file_path_env = getenv(logging_file_environment_variable);
env[logging_file_environment_variable].to_string(); // NOLINTNEXTLINE(concurrency-mt-unsafe)
std::string verbosity = const char* verbosity_env = getenv(logging_verbosity_environment_variable);
env[logging_verbosity_environment_variable].to_string(); 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 // 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, // level (and technically it will also work fine if it's the only option,
+6 -9
View File
@@ -24,15 +24,12 @@
namespace fs = ghc::filesystem; namespace fs = ghc::filesystem;
bool pid_running(pid_t pid) { bool pid_running(pid_t pid) {
// With regular individually hosted plugins we can simply check whether the // In theory you could `kill(0)` a process to check if it's still active,
// process is still running, however Boost.Process does not allow you to do // but that doesn't distinguish between actually running processes and
// the same thing for a process that's not a direct child if this process. // unreaped zombies, and terminated group host processes will always be left
// When using plugin groups we'll have to manually check whether the PID // as zombies since there may not be anything left to reap them. Instead
// returned by the group host process is still active. We sadly can't use // we'll check whether one of `/proc/<pid>/{cwd,exe,root}` are valid
// `kill()` for this as that provides no way to distinguish between active // symlinks.
// processes and zombies, and a terminated group host process will always be
// left as a zombie process. If the process is active, then
// `/proc/<pid>/{cwd,exe,root}` will be valid symlinks.
std::error_code err; std::error_code err;
fs::canonical("/proc/" + std::to_string(pid) + "/exe", err); fs::canonical("/proc/" + std::to_string(pid) + "/exe", err);
-1
View File
@@ -41,7 +41,6 @@
// FIXME: Remove Boost stuff // FIXME: Remove Boost stuff
#include <boost/predef.h> #include <boost/predef.h>
#include <asio/basic_socket_streambuf.hpp> #include <asio/basic_socket_streambuf.hpp>
#include <boost/asio/basic_socket_streambuf.hpp>
#include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/mapped_region.hpp>
// #include <asio/asio/detail/timer_queue_ptime.hpp> // #include <asio/asio/detail/timer_queue_ptime.hpp>
// #include <boost/interprocess/detail/workaround.hpp> // #include <boost/interprocess/detail/workaround.hpp>