Merge pull request #143 from fireice-uk/topic-add-win-exit

Add windows exit
This commit is contained in:
fireice-uk
2017-11-19 14:18:32 +00:00
committed by GitHub
3 changed files with 12 additions and 10 deletions
+6 -5
View File
@@ -302,18 +302,19 @@ int main(int argc, char *argv[])
if(opName.compare("-h") == 0 || opName.compare("--help") == 0)
{
help();
// \todo give return code to win_exit to allow passing CI
//win_exit();
win_exit(0);
return 0;
}
if(opName.compare("-v") == 0 || opName.compare("--version") == 0)
{
std::cout<< "Version: " << get_version_str_short() << std::endl;
win_exit();
return 0;
}
else if(opName.compare("-V") == 0 || opName.compare("--version-long") == 0)
{
std::cout<< "Version: " << get_version_str() << std::endl;
win_exit();
return 0;
}
else if(opName.compare("--noCPU") == 0)
@@ -432,13 +433,13 @@ int main(int argc, char *argv[])
if(!jconf::inst()->parse_config(params::inst().configFile.c_str()))
{
win_exit();
return 0;
return 1;
}
if (!BackendConnector::self_test())
{
win_exit();
return 0;
return 1;
}
#ifndef CONF_NO_HTTPD
@@ -447,7 +448,7 @@ int main(int argc, char *argv[])
if (!httpd::inst()->start_daemon())
{
win_exit();
return 0;
return 1;
}
}
#endif
+5 -4
View File
@@ -220,15 +220,16 @@ void printer::print_str(const char* str)
//Do a press any key for the windows folk. *insert any key joke here*
#ifdef _WIN32
void win_exit()
void win_exit(size_t code)
{
printer::inst()->print_str("Press any key to exit.");
get_key();
std::exit(1);
std::exit(code);
}
#else
void win_exit() {
std::exit(1);
void win_exit(size_t code)
{
std::exit(code);
}
#endif // _WIN32
+1 -1
View File
@@ -49,4 +49,4 @@ private:
FILE* logfile;
};
void win_exit();
void win_exit(size_t code = 1);