Salome HOME
Avoid additionnal CORBA invocation to clear context
[modules/kernel.git] / bin / runSalome.py
index 1a0e1134bf88c84baee812b6ed0771c3913b928d..8824d5381c89262517280b663e496e4efc64d441 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2022  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2022-2023  CEA, EDF, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -230,7 +230,7 @@ def foreGround(args, ior_fakens_filename):
         return
     import CORBA
     #import Engines
-    #import SALOME
+    import SALOME
     from time import sleep
     orb = CORBA.ORB_init([''], CORBA.ORB_ID)
     ior_fakens = None
@@ -254,6 +254,11 @@ def foreGround(args, ior_fakens_filename):
         logger.debug("Unfortunately Session not found into {} : Sleep and retry. {}/{}".format(ior_fakens_filename,nb,nbtot))
         if nb == nbtot:
             break
+
+    if session is None:
+        logger.debug("Couldn't find /Kernel/Session in the child process. Return.")
+        return
+
     nb = 0
     # --
     # Wait until gui is arrived
@@ -277,6 +282,7 @@ def foreGround(args, ior_fakens_filename):
         pass
     # --
     if not gui_detected:
+        logger.debug("Couldn't find active GUI in the current session. Return.")
         return
     # --
     from salome_utils import getPortNumber