Quit on ctrl+d

This commit is contained in:
Guillaume Beraudo 2013-07-19 15:33:17 +02:00
parent 9993524ada
commit 2b27923fc8

View file

@ -706,6 +706,7 @@ char *Daemon::readLine(const char *prompt) {
#ifdef HAVE_READLINE
return readline(prompt);
#else
if (cin.eof()) return NULL;
cout << prompt;
char *buff = (char *) malloc(sLineSize);
cin.getline(buff, sLineSize);
@ -735,6 +736,10 @@ int Daemon::run() {
if (mServerFd == -1 && ret != NULL) {
free(ret);
}
if (!ret && mRunning) {
mRunning = false; // ctrl+d
cout << "Quitting..." << endl;
}
}
stopThread();
return 0;