summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-01-22 09:42:37 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-01-22 09:42:37 +0100
commitb093e8e813e47d8fe15c15d1dfb099214f69aca7 (patch)
treec552a82adeffb6f56755c7d1df2f2e64eb98a6cb /src
parentMerge pull request #2895 from LogicParrot/readme (diff)
parentFix running as a service. (diff)
downloadcuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar.gz
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar.bz2
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar.lz
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar.xz
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.tar.zst
cuberite-b093e8e813e47d8fe15c15d1dfb099214f69aca7.zip
Diffstat (limited to 'src')
-rw-r--r--src/Root.cpp13
-rw-r--r--src/main.cpp3
2 files changed, 6 insertions, 10 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index 71d5875a6..2465cdfd4 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -92,7 +92,8 @@ void cRoot::InputThread(cRoot & a_Params)
}
// We have come here because the std::cin has received an EOF / a terminate signal has been sent, and the server is still running
- if (!std::cin.good())
+ // Ignore this when running as a service, cin was never opened in that case
+ if (!std::cin.good() && !m_RunAsService)
{
// Stop the server:
a_Params.QueueExecuteConsoleCommand("stop");
@@ -232,15 +233,7 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo)
{
m_StopEvent.Wait();
- if (m_TerminateEventRaised && m_RunAsService)
- {
- // Dont kill if running as a service
- m_TerminateEventRaised = false;
- }
- else
- {
- break;
- }
+ break;
}
// Stop the server:
diff --git a/src/main.cpp b/src/main.cpp
index 06f979097..1b77e2480 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -495,6 +495,9 @@ int main(int argc, char ** argv)
}
#endif
+ // Make sure m_RunAsService is set correctly before checking it's value
+ ParseArguments(argc, argv);
+
// Attempt to run as a service
if (cRoot::m_RunAsService)
{