mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +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 = r.readlines()
|
||||||
lines = map(str.rstrip, lines)
|
lines = map(str.rstrip, lines)
|
||||||
lines = filter(None, lines)
|
lines = filter(None, lines)
|
||||||
|
if lines:
|
||||||
irc.replies(lines, joiner=' ')
|
irc.replies(lines, joiner=' ')
|
||||||
|
else:
|
||||||
|
irc.error('It seems the configured fortune command was '
|
||||||
|
'not available.')
|
||||||
finally:
|
finally:
|
||||||
w.close()
|
w.close()
|
||||||
r.close()
|
r.close()
|
||||||
@ -273,16 +277,23 @@ class Unix(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
wtfCmd = self.registryValue('wtf.command')
|
wtfCmd = self.registryValue('wtf.command')
|
||||||
if wtfCmd:
|
if wtfCmd:
|
||||||
|
def commandError():
|
||||||
|
irc.error('It seems the configured wtf command '
|
||||||
|
'was not available.')
|
||||||
something = something.rstrip('?')
|
something = something.rstrip('?')
|
||||||
inst = popen2.Popen4([wtfCmd, something])
|
inst = popen2.Popen4([wtfCmd, something])
|
||||||
(r, w) = (inst.fromchild, inst.tochild)
|
(r, w) = (inst.fromchild, inst.tochild)
|
||||||
try:
|
try:
|
||||||
response = utils.normalizeWhitespace(r.readline().strip())
|
response = utils.normalizeWhitespace(r.readline().strip())
|
||||||
|
if response:
|
||||||
irc.reply(response)
|
irc.reply(response)
|
||||||
|
else:
|
||||||
|
commandError()
|
||||||
finally:
|
finally:
|
||||||
r.close()
|
r.close()
|
||||||
w.close()
|
w.close()
|
||||||
inst.wait()
|
inst.wait()
|
||||||
|
commandError()
|
||||||
else:
|
else:
|
||||||
irc.error('I couldn\'t find the wtf command on this system. '
|
irc.error('I couldn\'t find the wtf command on this system. '
|
||||||
'If it is installed on this system, reconfigure the '
|
'If it is installed on this system, reconfigure the '
|
||||||
|
Loading…
Reference in New Issue
Block a user