From: jfa Date: Mon, 30 May 2022 14:36:28 +0000 (+0300) Subject: Remove old log file before the application start X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fjfa%2F29467_gui_log_file;p=modules%2Fkernel.git Remove old log file before the application start --- diff --git a/bin/runSalomeCommon.py b/bin/runSalomeCommon.py index a31aee6d9..6578e3f95 100755 --- a/bin/runSalomeCommon.py +++ b/bin/runSalomeCommon.py @@ -302,7 +302,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