summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2017-11-19 14:18:32 +0000
committerGitHub <noreply@github.com>2017-11-19 14:18:32 +0000
commit0005e4ae88fb719f0bf5d669f3b260882b053d57 (patch)
treea5ba2e7aa53d95a00cbfe7249200331b5da5895f
parentc4f8c1a13332e52ab8f04bc549a50e1fe4305dea (diff)
parentbec1e69755d1708834a5944e0b36cd874c1983b5 (diff)
downloadxmr-stak-0005e4ae88fb719f0bf5d669f3b260882b053d57.zip
xmr-stak-0005e4ae88fb719f0bf5d669f3b260882b053d57.tar.gz
Merge pull request #143 from fireice-uk/topic-add-win-exit
Add windows exit
-rw-r--r--xmrstak/cli/cli-miner.cpp11
-rw-r--r--xmrstak/misc/console.cpp9
-rw-r--r--xmrstak/misc/console.hpp2
3 files changed, 12 insertions, 10 deletions
diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp
index 90da834..e152a02 100644
--- a/xmrstak/cli/cli-miner.cpp
+++ b/xmrstak/cli/cli-miner.cpp
@@ -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
diff --git a/xmrstak/misc/console.cpp b/xmrstak/misc/console.cpp
index ce63bcb..8de5948 100644
--- a/xmrstak/misc/console.cpp
+++ b/xmrstak/misc/console.cpp
@@ -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
diff --git a/xmrstak/misc/console.hpp b/xmrstak/misc/console.hpp
index 97e86bd..cfbeddd 100644
--- a/xmrstak/misc/console.hpp
+++ b/xmrstak/misc/console.hpp
@@ -49,4 +49,4 @@ private:
FILE* logfile;
};
-void win_exit();
+void win_exit(size_t code = 1);
OpenPOWER on IntegriCloud