mirror of https://github.com/progval/Limnoria.git
supybot-botchk: Directly execute supybot instead of running it in sh
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
960e1da61c
commit
c73ead8aef
2
RELNOTES
2
RELNOTES
|
@ -10,6 +10,8 @@ Factoids' config variable supybot.plugins.Factoids.factoidPrefix has been
|
|||
replaced by supybot.plugins.Factoids.format, which allows the user to
|
||||
determine exactly how replies to Factoid queries are formatted.
|
||||
|
||||
supybot-botchk no longer runs supybot inside an instance of /bin/sh.
|
||||
|
||||
|
||||
Version 0.83.4.1
|
||||
|
||||
|
|
|
@ -122,21 +122,14 @@ if __name__ == '__main__':
|
|||
debug('pidfile (%s) is not writable: %s' % (options.pidfile, e))
|
||||
sys.exit(-1)
|
||||
debug('Bot not found, starting.')
|
||||
home = os.environ['HOME']
|
||||
inst = subprocess.Popen('sh', close_fds=True, stderr=subprocess.STDOUT,
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
for filename in ('.login', '.bash_profile', '.profile', '.bashrc'):
|
||||
filename = os.path.join(home, filename)
|
||||
if os.path.exists(filename):
|
||||
debug('Found %s, sourcing.' % filename)
|
||||
inst.stdin.write('source %s' % filename + os.linesep)
|
||||
cmdline = '%s --daemon %s' % (options.supybot, options.conffile)
|
||||
debug('Sending cmdline to sh process.')
|
||||
inst.stdin.write(cmdline + os.linesep)
|
||||
inst.stdin.close()
|
||||
debug('Received from sh process: %r' % inst.stdout.read())
|
||||
cmdline = [options.supybot, '--daemon', options.conffile]
|
||||
inst = subprocess.Popen(cmdline, close_fds=True,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdin=None, stdout=subprocess.PIPE)
|
||||
debug('Output from supybot: %r' % inst.stdout.read())
|
||||
ret = inst.wait()
|
||||
debug('Bot started, command line %r returned %s.' % (cmdline, ret))
|
||||
debug('Bot started, command line %r returned %s.' % (' '.join(cmdline),
|
||||
ret))
|
||||
sys.exit(ret)
|
||||
else:
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Reference in New Issue