Server shuts down when the stdin is closed (linux Ctrl+D / win Ctrl+Z)
Fixes FS #419 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1679 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
bb4bb018ab
commit
df34c43293
@ -72,11 +72,20 @@ void cRoot::InputThread(void * a_Params)
|
|||||||
|
|
||||||
cLogCommandOutputCallback Output;
|
cLogCommandOutputCallback Output;
|
||||||
|
|
||||||
while (!(self.m_bStop || self.m_bRestart))
|
while (!(self.m_bStop || self.m_bRestart) && std::cin.good())
|
||||||
{
|
{
|
||||||
std::string Command;
|
std::string Command;
|
||||||
std::getline(std::cin, 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user