At 11:42 PM +0200 7/30/06, Martin v. Löwis wrote: >Tony Nelson schrieb: >>> You can use GenerateConsoleCtrlEvent to send Ctrl-C to all processes >>> that share the console of the calling process. >[...] >> Martin, your advice is usually spot-on, but I don't always understand it. >> Maybe using it here is just complicated. > >This was really just in response to your remark that you couldn't >find a way to send Ctrl-C programmatically. I researched (in >the C library sources) how SIGINT was *generated* (through >SetConsoleCtrlHandler), and that let me to a way to generate [one.]
Well, fine work there! >I didn't mean to suggest that you *should* use GenerateConsoleCtrlEvent, >only that you could if you wanted to. Hmm. Well, it would make the test possible on MSWindows as well as on OS's implementing alarm(2). If I figure out how to build Python on MSWindows, I might give it a try. I tried to get MSVC 7.1 via the .Net SDK, but it installed VS 8 instead, so I'm not quite sure how to proceed. >> I expect that >> GenerateConsoleCtrlEvent() can be called through the ctypes module, though >> that would make backporting the test to 2.4 a bit more difficult. > >Well, if there was general utility to that API, I would prefer exposing >it in the nt module. It doesn't quite fit into kill(2), as it doesn't >allow to specify a pid of the target process, so perhaps it doesn't >have general utility. In any case, that would have to wait for 2.6. A Process Group ID is the PID of the first process put in it, so it's sort of a PID. It just means a collection of processes, probably more than one. It seems to be mostly applicable to MSWindows, and isn't a suitable way to implement a form of kill(2). I hope that the Socket Timeouts patch 1519025 can make it into 2.5, or 2.5.1, as it is a bug fix. As such, it would probably be better to punt the test on MSWindows than to do a tricky fancy test that might have its own issues. ____________________________________________________________________ TonyN.:' <mailto:[EMAIL PROTECTED]> ' <http://www.georgeanelson.com/> _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com