Skip to content

Commit c73ead8

Browse files
committed
supybot-botchk: Directly execute supybot instead of running it in sh
Signed-off-by: James McCoy <[email protected]>
1 parent 960e1da commit c73ead8

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

RELNOTES

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Factoids' config variable supybot.plugins.Factoids.factoidPrefix has been
1010
replaced by supybot.plugins.Factoids.format, which allows the user to
1111
determine exactly how replies to Factoid queries are formatted.
1212

13+
supybot-botchk no longer runs supybot inside an instance of /bin/sh.
14+
1315

1416
Version 0.83.4.1
1517

scripts/supybot-botchk

+7-14
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,14 @@ if __name__ == '__main__':
122122
debug('pidfile (%s) is not writable: %s' % (options.pidfile, e))
123123
sys.exit(-1)
124124
debug('Bot not found, starting.')
125-
home = os.environ['HOME']
126-
inst = subprocess.Popen('sh', close_fds=True, stderr=subprocess.STDOUT,
127-
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
128-
for filename in ('.login', '.bash_profile', '.profile', '.bashrc'):
129-
filename = os.path.join(home, filename)
130-
if os.path.exists(filename):
131-
debug('Found %s, sourcing.' % filename)
132-
inst.stdin.write('source %s' % filename + os.linesep)
133-
cmdline = '%s --daemon %s' % (options.supybot, options.conffile)
134-
debug('Sending cmdline to sh process.')
135-
inst.stdin.write(cmdline + os.linesep)
136-
inst.stdin.close()
137-
debug('Received from sh process: %r' % inst.stdout.read())
125+
cmdline = [options.supybot, '--daemon', options.conffile]
126+
inst = subprocess.Popen(cmdline, close_fds=True,
127+
stderr=subprocess.STDOUT,
128+
stdin=None, stdout=subprocess.PIPE)
129+
debug('Output from supybot: %r' % inst.stdout.read())
138130
ret = inst.wait()
139-
debug('Bot started, command line %r returned %s.' % (cmdline, ret))
131+
debug('Bot started, command line %r returned %s.' % (' '.join(cmdline),
132+
ret))
140133
sys.exit(ret)
141134
else:
142135
sys.exit(0)

0 commit comments

Comments
 (0)