eric6/E5Network/E5JsonServer.py

changeset 8301
952a05857e81
parent 8300
72ba9635ec5c
child 8302
8feffa00a7d9
--- a/eric6/E5Network/E5JsonServer.py	Sun May 09 14:53:27 2021 +0200
+++ b/eric6/E5Network/E5JsonServer.py	Mon May 10 18:37:54 2021 +0200
@@ -217,12 +217,15 @@
         @type str
         @param environment dictionary of environment settings to pass
         @type dict
-        @return flag indicating a successful client start
-        @rtype bool
+        @return flag indicating a successful client start and the exit code
+            in case of an issue
+        @rtype bool, int
         """
         if interpreter == "" or not Utilities.isinpath(interpreter):
             return False
         
+        exitCode = None
+        
         proc = QProcess()
         proc.setProcessChannelMode(
             QProcess.ProcessChannelMode.ForwardedChannels)
@@ -253,10 +256,18 @@
                     # connection of the client (= slow start).
                     QCoreApplication.processEvents(
                         QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
+                    
+                    # check if client exited prematurely
+                    state = proc.state()
+                    if state == QProcess.ProcessState.NotRunning:
+                        exitCode = proc.exitCode()
+                        proc = None
+                        self.__clientProcesses[idString] = None
+                        break
         else:
             self.__clientProcess = proc
         
-        return proc is not None
+        return proc is not None, exitCode
     
     def stopClient(self, idString=""):
         """

eric ide

mercurial