Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # вставить перед if __name__ == '__main__':
- ########################################################################################################################
- # CTRLZ.py
- # Реализация прерывания по нажатию CTRL + C
- def sigint_handler(signum, frame):
- #print current_time.current_time() + 'CTRL + C Pressed, program is now stopped!'
- print ('CTRL + C Pressed, program is now stopped!')
- #os.abort() # Плохое решение, но работает в нашем случае, поскольку процесс уходит в фон и его иначе не завершить.
- #raise SystemExit(1)
- os.kill(os.getpid(),9)
- signal.signal(signal.SIGINT, sigint_handler)
- ########################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement