mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-22 04:19:48 +01:00
removed exit() in most places.. should just return EXIT_SUCCESS or failure instead of exiting, which was why the unique pointer needed a release (in this case, we removed pointer for consistency)
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
This commit is contained in:
@@ -527,7 +527,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'v':
|
||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return (EXIT_SUCCESS);
|
||||
|
||||
case 'n':
|
||||
try {
|
||||
@@ -564,17 +564,17 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'h':
|
||||
std::cout << help_message << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return (EXIT_SUCCESS);
|
||||
|
||||
default:
|
||||
LOG(sls::logERROR) << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
// remaining arguments
|
||||
if (optind < argc) {
|
||||
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
||||
|
||||
@@ -139,10 +139,9 @@ void GetData(slsDetectorDefs::sls_receiver_header &header,
|
||||
*/
|
||||
void sigInterruptHandler(int p) { sem_post(&semaphore); }
|
||||
|
||||
void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
||||
uint16_t &startPort,
|
||||
uint16_t &numReceivers,
|
||||
bool &callbackEnabled) {
|
||||
int GetDeprecatedCommandLineOptions(int argc, char *argv[], uint16_t &startPort,
|
||||
uint16_t &numReceivers,
|
||||
bool &callbackEnabled) {
|
||||
std::string deprecatedMessage =
|
||||
"Detected deprecated Options. Please update.\n";
|
||||
if (argc > 1) {
|
||||
@@ -154,12 +153,12 @@ void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
||||
LOG(sls::logWARNING) << deprecatedMessage;
|
||||
LOG(sls::logERROR)
|
||||
<< "Did you mix up the order of the arguments?";
|
||||
exit(EXIT_FAILURE);
|
||||
return slsDetectorDefs::FAIL;
|
||||
}
|
||||
if (numReceivers == 0) {
|
||||
LOG(sls::logWARNING) << deprecatedMessage;
|
||||
LOG(sls::logERROR) << "Invalid number of receivers.";
|
||||
exit(EXIT_FAILURE);
|
||||
return slsDetectorDefs::FAIL;
|
||||
}
|
||||
if (argc == 4) {
|
||||
callbackEnabled = sls::StringTo<bool>(argv[3]);
|
||||
@@ -169,9 +168,10 @@ void GetDeprecatedCommandLineOptions(int argc, char *argv[],
|
||||
} catch (const std::exception &e) {
|
||||
LOG(sls::logWARNING) << deprecatedMessage;
|
||||
LOG(sls::logERROR) << e.what();
|
||||
exit(EXIT_FAILURE);
|
||||
return slsDetectorDefs::FAIL;
|
||||
}
|
||||
}
|
||||
return slsDetectorDefs::OK;
|
||||
}
|
||||
|
||||
std::string getHelpMessage() {
|
||||
@@ -221,7 +221,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'v':
|
||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
case 'n':
|
||||
try {
|
||||
@@ -262,18 +262,20 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'h':
|
||||
std::cout << help_message << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
default:
|
||||
LOG(sls::logERROR) << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
// if remaining arguments, maintain backward compatibility of [startport]
|
||||
// [num-receivers] [callback]
|
||||
if (optind < argc) {
|
||||
GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers,
|
||||
callbackEnabled);
|
||||
if (slsDetectorDefs::FAIL ==
|
||||
GetDeprecatedCommandLineOptions(argc, argv, startPort, numReceivers,
|
||||
callbackEnabled))
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << ']';
|
||||
@@ -381,7 +383,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
LOG(sls::logINFOBLUE)
|
||||
<< "Exiting Child Process [ Tid: " << gettid() << ']';
|
||||
exit(EXIT_SUCCESS);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,5 +424,5 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
std::cout << "Goodbye!\n";
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'v':
|
||||
std::cout << argv[0] << " Version: " << APIRECEIVER << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return (EXIT_SUCCESS);
|
||||
|
||||
case 't':
|
||||
LOG(sls::logWARNING)
|
||||
@@ -78,17 +78,17 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'h':
|
||||
std::cout << help_message << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
return (EXIT_SUCCESS);
|
||||
|
||||
default:
|
||||
LOG(sls::logERROR) << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
// remaining arguments
|
||||
if (optind < argc) {
|
||||
LOG(sls::logERROR) << "Invalid arguments\n" << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG(sls::logINFOBLUE) << "Current Process [ Tid: " << gettid() << " ]";
|
||||
@@ -147,5 +147,5 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
LOG(sls::logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
|
||||
LOG(sls::logINFO) << "Exiting Receiver";
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user