1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-09-29 06:50:43 +00:00
falk-werner_webfuse/test-src/integration/webfuse/test/daemon.cpp

37 lines
504 B
C++
Raw Normal View History

2022-12-31 19:41:45 +00:00
#include "webfuse/test/daemon.hpp"
#include <limits.h>
#include <unistd.h>
#include <libgen.h>
#include <csignal>
namespace
{
std::string get_executable_path()
{
char directory[PATH_MAX] = { '\0' };
readlink("/proc/self/exe", directory, PATH_MAX);
dirname(directory);
return std::string(directory) + "/webfuse";
}
}
namespace webfuse
{
daemon::daemon(std::string const & mountpoint)
: p({get_executable_path(), "-f", mountpoint})
{
}
daemon::~daemon()
{
p.kill(SIGINT);
}
}