From 1f122fba234cabf8bb8cf6ff3148c1e4af764e9d Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Thu, 2 Sep 2021 16:42:47 +0530 Subject: [PATCH] Removed except block print statements & added specific message to sys.exit function --- src/singleinstance.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/singleinstance.py b/src/singleinstance.py index 188b2d1c..c1e20c4b 100644 --- a/src/singleinstance.py +++ b/src/singleinstance.py @@ -55,12 +55,7 @@ class singleinstance(object): ) except OSError as e: if e.errno == 13: - print( - 'Another instance of this application' - ' is already running' - ) - sys.exit(-1) - print(e.errno) + sys.exit('Another instance of this application is already running') raise else: pidLine = "%i\n" % self.lockPid @@ -75,8 +70,7 @@ class singleinstance(object): fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB) self.lockPid = os.getpid() except IOError: - print('Another instance of this application is already running') - sys.exit(-1) + sys.exit('Another instance of this application is already running') else: pidLine = "%i\n" % self.lockPid self.fp.truncate(0)