I’m playing with python under wine. The problem I’m facing is I’m unable to catch terminate signal in the program.
I run
$ wine python -c "import signal, time; signal.signal(signal.SIGTERM, print); time.sleep(60)"
Then I send SIGTERM to wine from another terminal, the program is terminated, but the signal handler is not called.
When I run the same program, but without wine, then it calls the signal handler as expected.
$ python -c "import signal, time; signal.signal(signal.SIGTERM, print); time.sleep(60)"
15 <frame at 0x76d2aed86560, file '<string>', line 1, code <module>>
15 <frame at 0x76d2aed86560, file '<string>', line 1, code <module>>
What’s the issue with python under wine? How to catch the termination signal, do some cleanup and then exit gracefully?
Wine: wine-9.0
Python: 3.12.5