return proper exit code

This commit is contained in:
badaix 2017-03-04 13:17:44 +01:00
parent d4e03989fb
commit 833a1957fc
2 changed files with 6 additions and 3 deletions

View file

@ -50,6 +50,7 @@ int main(int argc, char* argv[])
#ifdef MACOS
#pragma message "Warning: the macOS support is experimental and might not be maintained"
#endif
int exitcode = EXIT_SUCCESS;
try
{
StreamServerSettings settings;
@ -191,7 +192,6 @@ int main(int argc, char* argv[])
io_service.stop();
t.join();
logO << "Stopping streamServer" << endl;
streamServer->stop();
logO << "done" << endl;
@ -199,12 +199,13 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
logS(kLogErr) << "Exception: " << e.what() << std::endl;
exitcode = EXIT_FAILURE;
}
logS(kLogNotice) << "daemon terminated." << endl;
#ifdef HAS_DAEMON
daemonShutdown();
#endif
return 0;
exit(exitcode);
}