mmpy_bot icon indicating copy to clipboard operation
mmpy_bot copied to clipboard

Click decorated functions exit on --help

Open unode opened this issue 3 years ago • 2 comments

Since click is designed to wrap commands, some instructions, such as --help, trigger a system exit. If a sufficiently high number of requests is made, all threads will eventually be exhausted and the bot will stop responding.

How To Reproduce

  1. Decorate a function with @click.command
  2. Send command --help and see the thread die with click.exceptions.Exit: 0.

Expected behavior --help should not trigger a system exit or kill the thread. In general, worker threads should not die if an exception is raised.

Operating Environment (please complete the following information):

  • OS: Linux
  • Python Version: 3.9
  • mmpy_bot Version: 2.0 - git

unode avatar Jun 21 '21 01:06 unode

Ah nice catch, I've run into this before in other projects. It's a fairly easy fix I think, we can just catch a specific exception

jneeven avatar Jun 22 '21 08:06 jneeven

I have the same trouble

Shesoff avatar Jun 16 '22 07:06 Shesoff