mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Handle the case where the program isn't found.
This commit is contained in:
parent
625cfb4214
commit
eaf9f809ca
@ -253,7 +253,11 @@ class Unix(callbacks.Privmsg):
|
||||
lines = r.readlines()
|
||||
lines = map(str.rstrip, lines)
|
||||
lines = filter(None, lines)
|
||||
if lines:
|
||||
irc.replies(lines, joiner=' ')
|
||||
else:
|
||||
irc.error('It seems the configured fortune command was '
|
||||
'not available.')
|
||||
finally:
|
||||
w.close()
|
||||
r.close()
|
||||
@ -273,16 +277,23 @@ class Unix(callbacks.Privmsg):
|
||||
"""
|
||||
wtfCmd = self.registryValue('wtf.command')
|
||||
if wtfCmd:
|
||||
def commandError():
|
||||
irc.error('It seems the configured wtf command '
|
||||
'was not available.')
|
||||
something = something.rstrip('?')
|
||||
inst = popen2.Popen4([wtfCmd, something])
|
||||
(r, w) = (inst.fromchild, inst.tochild)
|
||||
try:
|
||||
response = utils.normalizeWhitespace(r.readline().strip())
|
||||
if response:
|
||||
irc.reply(response)
|
||||
else:
|
||||
commandError()
|
||||
finally:
|
||||
r.close()
|
||||
w.close()
|
||||
inst.wait()
|
||||
commandError()
|
||||
else:
|
||||
irc.error('I couldn\'t find the wtf command on this system. '
|
||||
'If it is installed on this system, reconfigure the '
|
||||
|
Loading…
Reference in New Issue
Block a user