aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/zenserverprocess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenutil/zenserverprocess.cpp')
-rw-r--r--src/zenutil/zenserverprocess.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp
index 0b0127f93..3667ad2c6 100644
--- a/src/zenutil/zenserverprocess.cpp
+++ b/src/zenutil/zenserverprocess.cpp
@@ -673,7 +673,14 @@ ZenServerInstance::AttachToRunningServer(int BasePort)
throw std::runtime_error("No server found");
}
- m_Process.Initialize(Entry->Pid);
+ std::error_code Ec;
+ m_Process.Initialize(Entry->Pid, Ec);
+
+ if (Ec)
+ {
+ throw std::system_error(Ec, fmt::format("failed to attach to running server on port {} using pid {}", BasePort, Entry->Pid.load()));
+ }
+
CreateShutdownEvent(Entry->EffectiveListenPort);
m_BasePort = Entry->EffectiveListenPort;
}