diff --git a/src/commands.py b/src/commands.py index 49d682437..983176751 100644 --- a/src/commands.py +++ b/src/commands.py @@ -61,6 +61,10 @@ def thread(f): f(self, irc, msg, args, *L, **kwargs) return utils.python.changeFunctionName(newf, f.func_name, f.__doc__) +class ProcessTimeoutError(Exception): + """Gets raised when a process is killed due to timeout.""" + pass + def process(f, *args, **kwargs): """Runs a function in a subprocess. @@ -85,7 +89,7 @@ def process(f, *args, **kwargs): p.join(timeout) if p.is_alive(): p.terminate() - return "%s aborted due to timeout." % (p.name,) + raise ProcessTimeoutError, "%s aborted due to timeout." % (p.name,) try: v = q.get(block=False) except Queue.Empty: