Capture lilv messages to log files.
Fixes dev-build warnings and build-machine errors.
This commit is contained in:
+1
-1
@@ -102,7 +102,7 @@ add_custom_command(
|
||||
|
||||
|
||||
set (PIPEDAL_SOURCES
|
||||
StdOutCapture.hpp StdOutCapture.cpp
|
||||
StdErrorCapture.hpp StdErrorCapture.cpp
|
||||
Ipv6Helpers.cpp Ipv6Helpers.hpp
|
||||
PluginPreset.cpp PluginPreset.hpp
|
||||
CpuGovernor.cpp CpuGovernor.hpp
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@
|
||||
#include "lv2/lv2plug.in/ns/ext/port-groups/port-groups.h"
|
||||
#include <fstream>
|
||||
#include "PiPedalException.hpp"
|
||||
#include "StdOutCapture.hpp"
|
||||
#include "StdErrorCapture.hpp"
|
||||
|
||||
#include "Locale.hpp"
|
||||
|
||||
@@ -391,7 +391,7 @@ void Lv2Host::Load(const char *lv2Path)
|
||||
free_world();
|
||||
|
||||
setenv("LV2_PATH", lv2Path, true);
|
||||
StdOutCapture stdoutCapture; // captures lilv messages written to STDOUT.
|
||||
StdErrorCapture stdoutCapture; // captures lilv messages written to STDOUT.
|
||||
pWorld = lilv_world_new();
|
||||
{
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
#include "StdOutCapture.hpp"
|
||||
#include "StdErrorCapture.hpp"
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@@ -38,18 +38,19 @@
|
||||
using namespace pipedal;
|
||||
|
||||
constexpr int STDOUT_HANDLE = 2;
|
||||
StdOutCapture::StdOutCapture()
|
||||
StdErrorCapture::StdErrorCapture()
|
||||
{
|
||||
this->tempFileName = std::tmpnam(nullptr);
|
||||
char filename[] = "/tmp/pipedal.XXXXXX";
|
||||
int redirectHandle = mkstemp(filename);
|
||||
this->tempFileName = filename;
|
||||
|
||||
int redirectHandle = open(tempFileName.c_str(),O_CREAT | O_WRONLY | O_TRUNC);
|
||||
this->oldStdout = dup(STDOUT_HANDLE);
|
||||
dup2(redirectHandle,STDOUT_HANDLE);
|
||||
close(redirectHandle);
|
||||
|
||||
|
||||
}
|
||||
StdOutCapture::~StdOutCapture()
|
||||
StdErrorCapture::~StdErrorCapture()
|
||||
{
|
||||
EndCapture();
|
||||
if (tempFileName.length() != 0)
|
||||
@@ -58,7 +59,7 @@ StdOutCapture::~StdOutCapture()
|
||||
}
|
||||
}
|
||||
|
||||
void StdOutCapture::EndCapture()
|
||||
void StdErrorCapture::EndCapture()
|
||||
{
|
||||
|
||||
if (this->oldStdout != -1)
|
||||
@@ -70,7 +71,7 @@ void StdOutCapture::EndCapture()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> StdOutCapture::GetOutputLines() {
|
||||
std::vector<std::string> StdErrorCapture::GetOutputLines() {
|
||||
EndCapture();
|
||||
|
||||
std::vector<std::string> result;
|
||||
@@ -20,13 +20,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace pipedal {
|
||||
|
||||
class StdOutCapture {
|
||||
class StdErrorCapture {
|
||||
public:
|
||||
StdOutCapture();
|
||||
~StdOutCapture();
|
||||
StdErrorCapture();
|
||||
~StdErrorCapture();
|
||||
|
||||
void EndCapture();
|
||||
|
||||
Reference in New Issue
Block a user