summaryrefslogtreecommitdiffstats
path: root/source/Root.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-24 22:25:27 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-24 22:25:27 +0200
commitdf34c4329307508310fb1018d62b0531c94bc6c7 (patch)
tree639662c7c2fee856e487994dc2956d993709312b /source/Root.cpp
parentDocs: Added the cPawn -> cPlayer API class inheritance (diff)
downloadcuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar.gz
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar.bz2
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar.lz
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar.xz
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.tar.zst
cuberite-df34c4329307508310fb1018d62b0531c94bc6c7.zip
Diffstat (limited to '')
-rw-r--r--source/Root.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/Root.cpp b/source/Root.cpp
index 771986003..59242c60d 100644
--- a/source/Root.cpp
+++ b/source/Root.cpp
@@ -72,11 +72,20 @@ void cRoot::InputThread(void * a_Params)
cLogCommandOutputCallback Output;
- while (!(self.m_bStop || self.m_bRestart))
+ while (!(self.m_bStop || self.m_bRestart) && std::cin.good())
{
std::string Command;
std::getline(std::cin, Command);
- self.ExecuteConsoleCommand(Command, Output);
+ if (!Command.empty())
+ {
+ self.ExecuteConsoleCommand(Command, Output);
+ }
+ }
+
+ if (!(self.m_bStop || self.m_bRestart))
+ {
+ // We have come here because the std::cin has received an EOF and the server is still running; stop the server:
+ self.m_bStop = true;
}
}