This is an automated email from the ASF dual-hosted git repository. skygo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans-native-launchers.git
commit 7ed198dbaa6a7d7bf2ffcf2347d4aad9eedb03e1 Author: Svatopluk Dedic <svatopluk.de...@oracle.com> AuthorDate: Sun Nov 8 17:10:32 2020 +0100 Prevent race conditions during CLI install (#2523) * Use a special exitcode when connecting to CLI as client. Do not run upgrade step thereafter. * Piggyback with NBJLS server relaunch after installation completes. * Delay and/or disable the restart LSP client after connection termination with the hope to finish install tasks meanwhile and then restart explicitly * Wait after last child closes on Win. * Fixed launchers release number -> release. Co-authored-by: Jaroslav Tulach <jaroslav.tul...@oracle.com> --- nbexec.cpp | 9 ++++++++- platformlauncher.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nbexec.cpp b/nbexec.cpp index 2e63d02..47e490e 100644 --- a/nbexec.cpp +++ b/nbexec.cpp @@ -43,9 +43,16 @@ extern "C" BOOL APIENTRY DllMain(HANDLE hModule, return TRUE; } +volatile int exitStatus = 0; + void exitHook(int status) { + exitStatus = status; logMsg("Exit hook called with status %d", status); - launcher.onExit(); + // do not handle possible restarts, if we are just CLI-connecting to a running process. + if (status != -252) { + launcher.onExit(); + } + logMsg("Exit hook terminated."); } #define NBEXEC_EXPORT extern "C" __declspec(dllexport) diff --git a/platformlauncher.cpp b/platformlauncher.cpp index b29b309..8df954c 100644 --- a/platformlauncher.cpp +++ b/platformlauncher.cpp @@ -24,6 +24,8 @@ #include "platformlauncher.h" #include "argnames.h" +volatile extern int exitStatus; + using namespace std; const char *PlatformLauncher::HELP_MSG = @@ -662,6 +664,10 @@ bool PlatformLauncher::restartRequested() { void PlatformLauncher::onExit() { logMsg("onExit()"); + if (exitStatus == -252) { + logMsg("Exiting from CLI client, will not restart."); + return; + } if (exiting) { logMsg("Already exiting, no need to schedule restart"); @@ -714,7 +720,8 @@ void PlatformLauncher::onExit() { STARTUPINFO si = {0}; PROCESS_INFORMATION pi = {0}; si.cb = sizeof(STARTUPINFO); - if (!CreateProcess(NULL, cmdLineStr, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + + if (!CreateProcess(NULL, cmdLineStr, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) { logErr(true, true, "Failed to create process."); return; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists