1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/test-src/integration/webfuse/test/daemon.cpp
2023-01-25 21:22:51 +01:00

38 lines
505 B
C++

#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);
}
}