]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Remove old log file before the application start
authorjfa <jfa@opencascade.com>
Mon, 30 May 2022 14:36:28 +0000 (17:36 +0300)
committerPascal Obry <pascal.obry@edf.fr>
Tue, 5 Sep 2023 13:34:11 +0000 (15:34 +0200)
bin/runSalomeCommon.py

index 7f3a05e0e0aebd643b526e7cd84a007dc4948a43..841f62a65a366bf13cf02d9f04e712f9854b2809 100755 (executable)
@@ -332,7 +332,15 @@ class CommonSessionServer(Server):
                     pass
                 pass
                 if self.args['gui_log_file'] is not None:
-                    self.SCMD2+=['--gui-log-file=%s'%self.args['gui_log_file']]
+                    guilogfile = self.args['gui_log_file']
+                    if os.path.exists(guilogfile) and os.path.isfile(guilogfile):
+                        try:
+                            os.remove(guilogfile)
+                        except:
+                            print("Error: cannot remove existing log file", guilogfile)
+                            guilogfile = None
+                    if guilogfile is not None:
+                        self.SCMD2+=['--gui-log-file=%s'%guilogfile]
                     pass
                 pass
             pass