mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
Merge pull request #143 from fireice-uk/topic-add-win-exit
Add windows exit
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user