Skip to content
Snippets Groups Projects
Unverified Commit 0005e4ae authored by fireice-uk's avatar fireice-uk Committed by GitHub
Browse files

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

Add windows exit
parents c4f8c1a1 bec1e697
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......@@ -49,4 +49,4 @@ private:
FILE* logfile;
};
void win_exit();
void win_exit(size_t code = 1);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment