Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50894
| From | Matthew Lefavor <mclefavor@gmail.com> |
|---|---|
| Date | 2013-07-18 14:44 -0400 |
| Subject | KeyboardInterrupt in Subproccesses |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4860.1374220233.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
All: I am maintaining a program in Python 2 and need to send it a KeyboardInterrupt to close it. Unfortunately, the program is used as a subprocess in a wrapper subprocess, and so I cannot just directly press CTL-C; I have to use a signal. When I run the program "bare" (not in a subprocess), I have found that raising a SIGINT (kill -2) raises a KeyboardInterrupt in the program. But when I run the program in the wrapper process, kill -2 no longer has any effect (whether it is raised by the wrapper or externally). Why is that the case? Does Python's interpretation of SIGINT as a KeyboardInterrupt only obtain when the program is run in a terminal? Is there something else I'm missing? Bonus points: Is this behavior the same for Python 3? MCL
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
KeyboardInterrupt in Subproccesses Matthew Lefavor <mclefavor@gmail.com> - 2013-07-18 14:44 -0400
csiph-web