I have the following code:
import click
@click.command()
def main():
while True:
pass
try:
main()
except KeyboardInterrupt:
print('My own message!')
当我按下 Ctrl+C 退出程序时,我想打印自己的信息。但是,点击会拦截错误,这是输出结果:
^C
Aborted!
我该如何阻止 click 处理错误?