You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/11/05 18:22:29 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2523: Prevent race conditions during CLI install

JaroslavTulach commented on a change in pull request #2523:
URL: https://github.com/apache/netbeans/pull/2523#discussion_r518262524



##########
File path: platform/o.n.bootstrap/launcher/windows/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) {

Review comment:
       OK.

##########
File path: java/java.lsp.server/vscode/src/extension.ts
##########
@@ -163,14 +163,45 @@ export function activate(context: ExtensionContext) {
     }));
 }
 
+/**
+ * Pending maintenance (install) task, activations should be chained after it.
+ */
+let maintenance : Promise<void> | null;
+
+/**
+ * Pending activation flag. Will be cleared when the process produces some message or fails.
+ */
+let activationPending : boolean = false;

Review comment:
       I would prefer to reduce this static state somehow. Not sure how yet.

##########
File path: platform/o.n.bootstrap/src/org/netbeans/MainImpl.java
##########
@@ -60,7 +60,7 @@ public static void main (String args[]) throws Exception {
         int res = execute (args, System.in, System.out, System.err, m);
         if (res == -1) {
             // Connected to another running NB instance and succeeded in making a call.
-            return;
+            System.exit(CLIHandler.Status.CONNECTED);

Review comment:
       OK.

##########
File path: platform/o.n.bootstrap/launcher/windows/platformlauncher.cpp
##########
@@ -662,6 +664,10 @@ bool PlatformLauncher::restartRequested() {
 
 void PlatformLauncher::onExit() {
     logMsg("onExit()");
+    if (exitStatus == -252) {

Review comment:
       OK.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists