Added small timer before closing stderr to make sure all closing messages are properly printed.
This commit is contained in:
parent
63c4e5d1e6
commit
74d491d3ff
1 changed files with 4 additions and 2 deletions
|
@ -266,11 +266,13 @@ int main(int argc, char ** argv){
|
||||||
Controller::Log("CONF", "Controller shutting down because of socket problem (API port closed)");
|
Controller::Log("CONF", "Controller shutting down because of socket problem (API port closed)");
|
||||||
}
|
}
|
||||||
Controller::conf.is_active = false;
|
Controller::conf.is_active = false;
|
||||||
//close stderr to make the stderr reading thread exit
|
|
||||||
close(STDERR_FILENO);
|
|
||||||
//join all joinable threads
|
//join all joinable threads
|
||||||
statsThread.join();
|
statsThread.join();
|
||||||
monitorThread.join();
|
monitorThread.join();
|
||||||
|
//give everything some time to print messages
|
||||||
|
Util::wait(100);
|
||||||
|
//close stderr to make the stderr reading thread exit
|
||||||
|
close(STDERR_FILENO);
|
||||||
//write config
|
//write config
|
||||||
if ( !Controller::WriteFile(Controller::conf.getString("configFile"), Controller::Storage.toString())){
|
if ( !Controller::WriteFile(Controller::conf.getString("configFile"), Controller::Storage.toString())){
|
||||||
std::cerr << "Error writing config " << Controller::conf.getString("configFile") << std::endl;
|
std::cerr << "Error writing config " << Controller::conf.getString("configFile") << std::endl;
|
||||||
|
|
Loading…
Add table
Reference in a new issue