]> git.pld-linux.org Git - packages/PyMSNt.git/blame - PyMSNt-remove-pid.patch
- added bugfixes from gentoo
[packages/PyMSNt.git] / PyMSNt-remove-pid.patch
CommitLineData
bfce6709 1--- pymsn-t/src/main.py 2008-04-04 17:45:43.000000000 +0400
2+++ pymsn-t/src/main.py 2008-08-05 17:44:17.000000000 +0400
3@@ -91,6 +91,7 @@
4 from twisted.words.xish.domish import Element
5 from twisted.words.protocols.jabber import component
6 from twisted.words.protocols.jabber.jid import internJID
7+from twisted.python import log
8
9 from debug import LogEvent, INFO, WARN, ERROR
10
11@@ -352,13 +353,29 @@
12 pf = open(config.pid, "w")
13 pf.write("%s\n" % pid)
14 pf.close()
15+
16+ def removePID(self, pidfile):
17+ # Remove a PID file
18+ if not pidfile:
19+ return
20+ try:
21+ os.unlink(pidfile)
22+ except OSError, e:
23+ if e.errno == errno.EACCES or e.errno == errno.EPERM:
24+ log.msg("Warning: No permission to delete pid file")
25+ else:
26+ log.msg("Failed to unlink PID file:")
27+ log.deferr()
28+ except:
29+ log.msg("Failed to unlink PID file:")
30+ log.deferr()
31
32 def shuttingDown(self):
33 self.transportSvc.removeMe()
34 # Keep the transport running for another 3 seconds
35 def cb(ignored=None):
36 if config.pid:
37- twistd.removePID(config.pid)
38+ self.removePID(config.pid)
39 d = Deferred()
40 d.addCallback(cb)
41 reactor.callLater(3.0, d.callback, None)
This page took 0.058786 seconds and 4 git commands to generate.