Skip to content

Commit

Permalink
Merge pull request #143 from fireice-uk/topic-add-win-exit
Browse files Browse the repository at this point in the history
Add windows exit
  • Loading branch information
fireice-uk authored Nov 19, 2017
2 parents c4f8c1a + bec1e69 commit 0005e4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions xmrstak/cli/cli-miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -447,7 +448,7 @@ int main(int argc, char *argv[])
if (!httpd::inst()->start_daemon())
{
win_exit();
return 0;
return 1;
}
}
#endif
Expand Down
9 changes: 5 additions & 4 deletions xmrstak/misc/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion xmrstak/misc/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ class printer
FILE* logfile;
};

void win_exit();
void win_exit(size_t code = 1);

0 comments on commit 0005e4a

Please sign in to comment.