aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/zenserverprocess.cpp
diff options
context:
space:
mode:
authorLiam Mitchell <[email protected]>2025-07-29 23:04:15 +0000
committerLiam Mitchell <[email protected]>2025-07-29 23:04:15 +0000
commitbf0039cbab6dc21ce09c15be60878ee4208d8723 (patch)
tree553353471925c72459b91563ccceb17accd51ec3 /src/zenutil/zenserverprocess.cpp
parentAlways upload vcpkg logs on failure (diff)
parent5.6.14 (diff)
downloadzen-bf0039cbab6dc21ce09c15be60878ee4208d8723.tar.xz
zen-bf0039cbab6dc21ce09c15be60878ee4208d8723.zip
Merge branch 'main' into de/zen-service-command
Diffstat (limited to 'src/zenutil/zenserverprocess.cpp')
-rw-r--r--src/zenutil/zenserverprocess.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp
index 0409cb976..4fd1cef9a 100644
--- a/src/zenutil/zenserverprocess.cpp
+++ b/src/zenutil/zenserverprocess.cpp
@@ -547,7 +547,7 @@ ZenServerEnvironment::CreateNewTestDir()
TestDir << "test"sv << int64_t(ZenServerTestCounter.fetch_add(1));
std::filesystem::path TestPath = m_TestBaseDir / TestDir.c_str();
- ZEN_ASSERT(!std::filesystem::exists(TestPath));
+ ZEN_ASSERT(!IsDir(TestPath));
ZEN_INFO("Creating new test dir @ '{}'", TestPath);
@@ -581,7 +581,7 @@ ZenServerInstance::~ZenServerInstance()
{
Shutdown();
std::error_code DummyEc;
- std::filesystem::remove(std::filesystem::temp_directory_path() / ("zenserver_" + m_Name + ".log"), DummyEc);
+ RemoveFile(std::filesystem::temp_directory_path() / ("zenserver_" + m_Name + ".log"), DummyEc);
}
catch (const std::exception& Err)
{
@@ -632,6 +632,7 @@ ZenServerInstance::Shutdown()
std::error_code Ec;
if (SignalShutdown(Ec))
{
+ Stopwatch Timer;
ZEN_DEBUG("Waiting for zenserver process {} ({}) to shut down", m_Name, m_Process.Pid());
while (!m_Process.Wait(1000))
{
@@ -645,7 +646,10 @@ ZenServerInstance::Shutdown()
ZEN_WARN("Wait abandoned by exited process");
return 0;
}
- ZEN_WARN("Waiting for zenserver process {} ({}) timed out", m_Name, m_Process.Pid());
+ ZEN_WARN("Waited for zenserver process {} ({}) to exit for {}",
+ m_Name,
+ m_Process.Pid(),
+ NiceTimeSpanMs(Timer.GetElapsedTimeMs()));
}
ZEN_DEBUG("zenserver process {} ({}) exited", m_Name, m_Process.Pid());
int ExitCode = m_Process.GetExitCode();
@@ -1046,7 +1050,7 @@ std::string
ZenServerInstance::GetLogOutput() const
{
std::filesystem::path OutputPath = std::filesystem::temp_directory_path() / ("zenserver_" + m_Name + ".log");
- if (std::filesystem::is_regular_file(OutputPath))
+ if (IsFile(OutputPath))
{
FileContents Contents = ReadFile(OutputPath);
if (!Contents.ErrorCode)
@@ -1068,7 +1072,7 @@ ZenServerInstance::Terminate()
const std::filesystem::path BaseDir = m_Env.ProgramBaseDir();
const std::filesystem::path Executable = BaseDir / "zenserver" ZEN_EXE_SUFFIX_LITERAL;
ProcessHandle RunningProcess;
- std::error_code Ec = FindProcess(Executable, RunningProcess);
+ std::error_code Ec = FindProcess(Executable, RunningProcess, /*IncludeSelf*/ false);
if (Ec)
{
throw std::system_error(Ec, fmt::format("failed to look up running server executable '{}'", Executable));
@@ -1136,7 +1140,7 @@ ValidateLockFileInfo(const LockFileInfo& Info, std::string& OutReason)
OutReason = fmt::format("listen port ({}) is not valid", Info.EffectiveListenPort);
return false;
}
- if (!std::filesystem::is_directory(Info.DataDir))
+ if (!IsDir(Info.DataDir))
{
OutReason = fmt::format("data directory ('{}') does not exist", Info.DataDir);
return false;