Virtualize ServerApplication::handlePidFile() (#4223)

* feat(OptionSet): Add replaceOption() #4181

* revert changes #4181

* feat: make ServerApplication::handlePidFile virtual #4181

* move handlePidFile() out of ifdef #4181

* fix(ServerApplication): move handlePidFile() out of all ifdefs #4181

---------

Co-authored-by: Pavle <pavle@debian-gnu-linux-11.localdomain>
Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com>
This commit is contained in:
Pavle Dragisic 2023-11-21 06:36:36 +01:00 committed by GitHub
parent 39e35c316d
commit f30d759c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -166,12 +166,12 @@ protected:
#endif
private:
virtual void handlePidFile(const std::string& name, const std::string& value);
#if defined(POCO_VXWORKS)
static Poco::Event _terminate;
#elif defined(POCO_OS_FAMILY_UNIX)
void handleDaemon(const std::string& name, const std::string& value);
void handleUMask(const std::string& name, const std::string& value);
void handlePidFile(const std::string& name, const std::string& value);
bool isDaemon(int argc, char** argv);
void beDaemon();
#if POCO_OS == POCO_OS_ANDROID

View File

@ -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)
@ -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>
@ -706,6 +706,9 @@ void ServerApplication::handleUMask(const std::string& name, const std::string&
}
#endif
void ServerApplication::handlePidFile(const std::string& name, const std::string& value)
{
Poco::FileOutputStream ostr(value);
@ -717,7 +720,4 @@ void ServerApplication::handlePidFile(const std::string& name, const std::string
}
#endif
} } // namespace Poco::Util