Removed except block print statements & added specific message to sys.exit function
This commit is contained in:
parent
3534729421
commit
1f122fba23
|
@ -55,12 +55,7 @@ class singleinstance(object):
|
||||||
)
|
)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == 13:
|
if e.errno == 13:
|
||||||
print(
|
sys.exit('Another instance of this application is already running')
|
||||||
'Another instance of this application'
|
|
||||||
' is already running'
|
|
||||||
)
|
|
||||||
sys.exit(-1)
|
|
||||||
print(e.errno)
|
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
pidLine = "%i\n" % self.lockPid
|
pidLine = "%i\n" % self.lockPid
|
||||||
|
@ -75,8 +70,7 @@ class singleinstance(object):
|
||||||
fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.lockf(self.fp, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
self.lockPid = os.getpid()
|
self.lockPid = os.getpid()
|
||||||
except IOError:
|
except IOError:
|
||||||
print('Another instance of this application is already running')
|
sys.exit('Another instance of this application is already running')
|
||||||
sys.exit(-1)
|
|
||||||
else:
|
else:
|
||||||
pidLine = "%i\n" % self.lockPid
|
pidLine = "%i\n" % self.lockPid
|
||||||
self.fp.truncate(0)
|
self.fp.truncate(0)
|
||||||
|
|
Reference in New Issue
Block a user