commands: Add a helpful error message instead of OSError when a subprocess can't be started.

This commit is contained in:
Valentin Lorentz 2020-06-20 12:57:15 +02:00
parent 0e2b0a96c8
commit 76ead86e2c

View File

@ -129,7 +129,17 @@ def process(f, *args, **kwargs):
targetArgs = (f, q,) + args targetArgs = (f, q,) + args
p = callbacks.CommandProcess(target=newf, p = callbacks.CommandProcess(target=newf,
args=targetArgs, kwargs=kwargs) args=targetArgs, kwargs=kwargs)
try:
p.start() p.start()
except OSError as e:
log.error(
'Failed to start a subprocess because of the following error: %s '
'This might be caused by the way Limnoria is demonized / run in '
'the background. Instead, try running it as a service '
'<https://docs.limnoria.net/use/supybot-botchk.html>, '
'use the --daemon option, or run it in screen/tmux.',
e)
raise
p.join(timeout) p.join(timeout)
if p.is_alive(): if p.is_alive():
p.terminate() p.terminate()