From a3d34f81970c4682c38bd892e7fceb48e215fdd8 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 22 Jun 2021 18:37:26 +0200 Subject: [PATCH] Use vfork() for quick running commands We can't use it for the Wine plugin host process, but it's perfectly suitable for these things. --- src/plugin/utils.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugin/utils.cpp b/src/plugin/utils.cpp index f56e6ba5..af6a0674 100644 --- a/src/plugin/utils.cpp +++ b/src/plugin/utils.cpp @@ -16,10 +16,14 @@ #include "utils.h" +// Boost.Process's auto detection for vfork() support doesn't seem to work +#define BOOST_POSIX_HAS_VFORK 1 + #include #include #include #include +#include #include #include #include @@ -109,7 +113,8 @@ std::string PluginInfo::wine_version() const { bp::ipstream output; try { - bp::system(wine_path, "--version", bp::std_out = output, bp::env = env); + bp::system(wine_path, "--version", bp::std_out = output, bp::env = env, + bp::posix::use_vfork); } catch (const std::system_error&) { return ""; } @@ -396,7 +401,7 @@ bool send_notification(const std::string& title, const std::string body) { try { return bp::system(bp::search_path("notify-send"), "--urgency=normal", "--expire-time=30000", "--app-name=yabridge", title, - body) == EXIT_SUCCESS; + body, bp::posix::use_vfork) == EXIT_SUCCESS; } catch (const boost::process::process_error&) { // We will have printed the message to the terminal anyways, so if the // user doesn't have libnotify installed we'll just fail silently