1
0
Fork 0
mirror of https://gitlab.com/niansa/libhss.git synced 2025-03-06 20:49:21 +01:00

Fixed problem when including hss.hpp more than once

This commit is contained in:
Nils 2021-07-22 01:36:41 +02:00
parent db8f46c6b1
commit 4a7b66635d

View file

@ -1,3 +1,5 @@
#ifndef _HSS_HPP
#define _HSS_HPP
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <unistd.h> #include <unistd.h>
@ -6,8 +8,9 @@
namespace HSS { namespace HSS {
inline void run(QBiIPC& ipc, const std::string& file) { inline pid_t run(QBiIPC& ipc, const std::string& file) {
if (fork() == 0) { auto pid = fork();
if (pid == 0) {
execlp("HSSChildLauncher", "child", execlp("HSSChildLauncher", "child",
std::to_string(ipc.out.get_in()).c_str(), std::to_string(ipc.out.get_in()).c_str(),
std::to_string(ipc.out.get_out()).c_str(), std::to_string(ipc.out.get_out()).c_str(),
@ -18,5 +21,7 @@ inline void run(QBiIPC& ipc, const std::string& file) {
std::cerr << "Failed to run HSSChildLauncher" << std::endl; std::cerr << "Failed to run HSSChildLauncher" << std::endl;
abort(); abort();
} }
return pid;
} }
} }
#endif