Add a way to disable pipes for the Wine host

For some reason ujam plugins (and other plugins made with the Gorilla
Engine, like the LoopCloud plugins) will throw a `JS_EXEC_FAILED` error
when trying to load the plugin while either of the STDOUT or STDERR
streams is pointing to a pipe. Simply redirecting the output to a file
fixes this. By default we'll write the output to
`<temporary_directory>/yabridge-plugin-output.log`, but you can also set
the new `disable_pipes` option to `"/dev/null"` to completely throw away
all output.

This addresses #47.
This commit is contained in:
Robbert van der Helm
2021-05-18 17:55:39 +02:00
parent 99428ba28e
commit 95badeb1bc
6 changed files with 128 additions and 41 deletions
+17
View File
@@ -24,6 +24,8 @@
#include <toml++/toml.h>
#include <fstream>
#include "utils.h"
namespace fs = boost::filesystem;
Configuration::Configuration() noexcept {}
@@ -84,6 +86,21 @@ Configuration::Configuration(const fs::path& config_path,
} else {
invalid_options.push_back(key);
}
} else if (key == "disable_pipes") {
// This option can be either enabled or disable with a boolean,
// or it can be set to an absolute path
if (const auto parsed_value = value.as_boolean()) {
if (*parsed_value) {
disable_pipes = get_temporary_directory() /
"yabridge-plugin-output.log";
} else {
disable_pipes = std::nullopt;
}
} else if (const auto parsed_value = value.as_string()) {
disable_pipes = parsed_value->get();
} else {
invalid_options.push_back(key);
}
} else if (key == "editor_double_embed") {
if (const auto parsed_value = value.as_boolean()) {
editor_double_embed = parsed_value->get();