Commit 383f06a5 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

Debugged and tested.

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4389
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5ea7432b
......@@ -67,7 +67,7 @@ class PidLockError(Exception):
def display(self):
sys.stderr.write("pidlock (ERROR): " + str(self.msg) + "\n")
if -1 =! line:
if -1 != self.line:
sys.stderr.write("triggered in line: " + str(self.line) + "\n")
# -----------------------------------------------------------------------------
......@@ -89,19 +89,20 @@ class PidLocker:
Announce a process with pid to the handler.
"""
# remove file if pid not valid anymore
if not self.lockValid():
if self.__access() and not self.lockValid():
os.remove(self.path)
else:
elif self.lockValid():
raise PidLockError(93, "Directory '{0}'locked.".format(self.directory))
# create a new pidlockfile
try:
pidfile = open(self.path, 'w')
pidfile.write("{0}".format(pid))
except IOError as err:
raise PidLockError(100, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
pidfile.close()
# create a new pidlockfile
try:
pidfile = open(self.path, 'w')
pidfile.write("{0}".format(pid))
except IOError as err:
raise PidLockError(100, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
pidfile.close()
def cancel(self, pid):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment