Added support for external writers

This commit is contained in:
Marco van Dijk 2022-09-14 15:01:51 +02:00 committed by Thulinma
parent 6921586622
commit 2b18a414b4
15 changed files with 510 additions and 154 deletions

30
test/converter.cpp Normal file
View file

@ -0,0 +1,30 @@
#include <iostream>
#include <mist/procs.h>
#include <mist/util.h>
#include <mist/defines.h>
#include <mist/socket.h>
#include <mist/timing.h>
#include <unistd.h>
int main(int argc, char **argv){
int fd = -1;
Util::printDebugLevel = 10;
pid_t pid = Util::startConverted(argv + 1, fd);
INFO_MSG("PID=%u", pid);
Socket::Connection in(-1, 0);
Socket::Connection logOut(fd, -1);
while (Util::Procs::childRunning(pid)){
if (in.spool()){
while (in.Received().size()){
logOut.SendNow(in.Received().get());
in.Received().get().clear();
}
}
if (!in){
logOut.close();
}
Util::sleep(1000);
}
INFO_MSG("Shutting down");
return 0;
}

View file

@ -2,6 +2,7 @@
# Testing binaries that are not unit tests, but intended for manual use
logtest = executable('logtest', 'log.cpp', dependencies: libmist_dep)
convertertest = executable('convertertest', 'converter.cpp', dependencies: libmist_dep)
downloadertest = executable('downloadertest', 'downloader.cpp', dependencies: libmist_dep)
urireadertest = executable('urireadertest', 'urireader.cpp', dependencies: libmist_dep)
jsontest = executable('jsontest', 'json.cpp', dependencies: libmist_dep)