From 255451d8456bd4a341dca40995ee34ad93ff2a42 Mon Sep 17 00:00:00 2001 From: Akshay Praveen Nair Date: Sun, 17 May 2020 05:32:48 +0530 Subject: [PATCH] Nawab: Fix the keyboard Interrupt This commit fixes #58 --- nawab.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nawab.py b/nawab.py index e0402a9..536017c 100644 --- a/nawab.py +++ b/nawab.py @@ -3,6 +3,7 @@ import pandas as pd import pwd import os +import sys import threading import argparse import logging @@ -119,5 +120,12 @@ def main(): nawab.tg_bot_run() -if __name__ == "__main__": - main() +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + print('Interrupted') + try: + sys.exit(0) + except SystemExit: + os._exit(0)