Added additional check for pidfile writability to supybot-botchk.

This commit is contained in:
Jeremy Fincher 2009-04-27 10:39:22 -05:00
parent 82db19754d
commit 92e2046b81

View File

@ -111,6 +111,13 @@ if __name__ == '__main__':
debug('Pid %s is not the bot.' % pid) debug('Pid %s is not the bot.' % pid)
if not foundBot: if not foundBot:
# First, we check if the pidfile is writable. If not, supybot will just exit,
# so we go ahead and refuse to start it.
try:
file(options.pidfile, 'r+')
except EnvironmentError, e:
fatal('pidfile (%s) is not writable: %s', options.pidfile, e)
sys.exit(-1)
debug('Bot not found, starting.') debug('Bot not found, starting.')
home = os.environ['HOME'] home = os.environ['HOME']
inst = popen2.Popen4('sh') inst = popen2.Popen4('sh')