Skip to content

Commit

Permalink
move handlePidFile() out of ifdef #4181
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Nov 21, 2023
1 parent 84bb1c9 commit 171ba46
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Util/src/ServerApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h"
#include "Poco/Util/OptionException.h"
#include "Poco/TemporaryFile.h"
#include "Poco/FileStream.h"
#include "Poco/Exception.h"
#if !defined(POCO_VXWORKS)
Expand All @@ -26,7 +27,6 @@
#include "Poco/Logger.h"
#include "Poco/String.h"
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS)
#include "Poco/TemporaryFile.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
Expand Down Expand Up @@ -436,6 +436,17 @@ void ServerApplication::handleStartup(const std::string& name, const std::string
}


void ServerApplication::handlePidFile(const std::string& name, const std::string& value)
{
Poco::FileOutputStream ostr(value);
if (ostr.good())
ostr << Poco::Process::id() << std::endl;
else
throw Poco::CreateFileException("Cannot write PID to file", value);
Poco::TemporaryFile::registerForDeletion(value);
}


#else // _WIN32_WCE
void ServerApplication::waitForTerminationRequest()
{
Expand Down Expand Up @@ -706,17 +717,6 @@ void ServerApplication::handleUMask(const std::string& name, const std::string&
}


void ServerApplication::handlePidFile(const std::string& name, const std::string& value)
{
Poco::FileOutputStream ostr(value);
if (ostr.good())
ostr << Poco::Process::id() << std::endl;
else
throw Poco::CreateFileException("Cannot write PID to file", value);
Poco::TemporaryFile::registerForDeletion(value);
}


#endif


Expand Down

0 comments on commit 171ba46

Please sign in to comment.