Fix empty line spam in log file when Wine crashes

This commit is contained in:
Robbert van der Helm
2020-05-19 12:27:32 +02:00
parent c2fceb6e4a
commit daad6f2f00
2 changed files with 11 additions and 6 deletions
+2
View File
@@ -14,6 +14,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### Fixed
- Fixed large amount of empty lines in the log file when the Wine process closes
unexpectedly.
- Made the plugin and host detection slightly more robust.
## [1.1.4] - 2020-05-12
+9 -6
View File
@@ -612,16 +612,19 @@ void PluginBridge::async_log_pipe_lines(patched_async_pipe& pipe,
boost::asio::streambuf& buffer,
std::string prefix) {
boost::asio::async_read_until(
pipe, buffer, '\n', [&, prefix](const auto&, size_t) {
pipe, buffer, '\n',
[&, prefix](const boost::system::error_code& error, size_t) {
// When we get an error code then that likely means that the pipe
// has been clsoed and we have reached the end of the file
if (error.failed()) {
return;
}
std::string line;
std::getline(std::istream(&buffer), line);
logger.log(prefix + line);
// Not sure why, but this async read will keep reading a ton of
// empty lines after the Wine process crashes
if (vst_host.running()) {
async_log_pipe_lines(pipe, buffer, prefix);
}
async_log_pipe_lines(pipe, buffer, prefix);
});
}