bakaid commented on a change in pull request #709: MINIFICPP-1088 - clean up 
minifiexe and MINIFI_HOME logic
URL: https://github.com/apache/nifi-minifi-cpp/pull/709#discussion_r366869925
 
 

 ##########
 File path: main/MiNiFiMain.cpp
 ##########
 @@ -142,94 +159,39 @@ int main(int argc, char **argv) {
 #ifdef WIN32
        if (!SetConsoleCtrlHandler(consoleSignalHandler, TRUE)) {
                logger->log_error("Cannot install signal handler");
-               std::cerr << "Cannot install signal handler" << std::endl;
-               return 1;
+               return -1;
        }
 
        if (signal(SIGINT, sigHandler) == SIG_ERR || signal(SIGTERM, 
sigHandler) == SIG_ERR ) {
-               std::cerr << "Cannot install signal handler" << std::endl;
+               logger->log_error("Cannot install signal handler");
                return -1;
        }
 #ifdef SIGBREAK
        if (signal(SIGBREAK, sigHandler) == SIG_ERR) {
-               std::cerr << "Cannot install signal handler" << std::endl;
+               logger->log_error("Cannot install signal handler");
                return -1;
        }
 #endif
 #else
        if (signal(SIGINT, sigHandler) == SIG_ERR || signal(SIGTERM, 
sigHandler) == SIG_ERR || signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
-               std::cerr << "Cannot install signal handler" << std::endl;
+    logger->log_error("Cannot install signal handler");
                return -1;
        }
 #endif
-       // assumes POSIX compliant environment
 
 Review comment:
   The original order of sources for MINIFI_HOME here was
   for *nix: MINIFI_HOME env -> realpath(argv[0]) (path of the current 
executable) -> cwd
   for Windows: MINIFI_HOME env -> GetModuleHandle (path of the current 
executable) -> cwd
   This has been cleaned up and unified in `determineMinifiHome` as:
    MINIFI_HOME env -> path of the current executable -> cwd
   The method used for determining the path of the current executable used now 
is superior to `realpath(argv[0])`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to