Lenard, I will commit your change, thanks.I must admit I took that recipe and used it without knowing exactly how it worked much the same way I would use a library.
How does the async Popen recipe look to you? I'm starting to wonder at the wisdom of using recipes. That was from ActiveState Python CookBook.
I put in one test for it but...... if ret_code is None: proc.kill()Should we make it try a few times upon failure? If it fails would there be much chance of killing it in the immediate future? What situations would cause a failure?
It might even make sense to move that kill functionality into the async_sub.Popen method read_async().
read_async(time_out=10, kill=True) Ciao.
I tried the updated run_tests and it works. Killed python interpreters disappear. Thanks for the changes.I do suggest some modifications to Popen.kill though. First, the win32api functions raise Python exceptions on Windows errors rather than use return values. Second, handles should be closed. Here is my version:def kill(self): """kill function for Win32""" try: handle = win32api.OpenProcess(1, 0, self.pid) try: win32api.TerminateProcess(handle, 0) finally: win32api.CloseHandle(handle) except win32api.error: return False return True