60 std::unique_ptr<interfaces::Init> spawnProcess(
const char*
new_exe_name)
override
65 auto init = m_protocol->connect(fd, m_exe_name);
67 int status = m_process->waitSpawned(
pid);
76 if (!m_process->checkSpawned(
argc,
argv, fd)) {
80 m_protocol->serve(fd, m_exe_name, m_init);
84 std::unique_ptr<interfaces::Init> connectAddress(std::string& address)
override
86 if (address.empty() || address ==
"0")
return nullptr;
88 if (address ==
"auto") {
96 }
catch (
const std::system_error&
e) {
98 if (
e.code() == std::errc::connection_refused ||
e.code() == std::errc::no_such_file_or_directory) {
106 return m_protocol->connect(fd, m_exe_name);
108 void listenAddress(std::string& address)
override
111 m_protocol->listen(fd, m_exe_name, m_init);
113 void disconnectIncoming()
override
115 m_protocol->disconnectIncoming();
117 void addCleanup(std::type_index type,
void*
iface, std::function<
void()> cleanup)
override
119 m_protocol->addCleanup(type,
iface, std::move(cleanup));
121 Context& context()
override {
return m_protocol->context(); }
122 const char* m_exe_name;
123 const char* m_process_argv0;
125 std::unique_ptr<Protocol> m_protocol;
126 std::unique_ptr<Process> m_process;
fs::path GetDataDirNet() const
Get data directory path with appended network identifier.
Initial interface created when a process is first started, and used to give and get access to other i...
Interface providing access to interprocess-communication (IPC) functionality.
#define LogDebug(category,...)
std::unique_ptr< Ipc > MakeIpc(const char *exe_name, const char *process_argv0, Init &init)
Return implementation of Ipc interface.
std::unique_ptr< Protocol > MakeCapnpProtocol()
std::unique_ptr< Process > MakeProcess()
Constructor for Process interface.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.