Terminating a subprocess question

Ernesto erniedude at gmail.com
Wed Mar 29 11:31:40 EST 2006


I'm opening a telnet session with the subprocess call below.  I then
wait ten seconds and attempt to terminate the telnet window I created.
Unfortuantely, the telnet window remains after the 'TerminateProcess"
call below.  This software works great for opening an executable
directly (i.e.  Handle = subprocess.Popen("myProgram.exe), but here I'm
using the Windows 'start' command inside, which I think has an effect.


Is there another way I can force termination of the telnet session I
create ?

# CODE STARTS HERE

TSS_Log_Path = "C:\\Log_Outputs\\TSS_Log_Test.txt"
TSS_Handle = subprocess.Popen("start telnet.exe -f " + TSS_Log_Path + "
localhost 6000",shell=True)
time.sleep(10)
ctypes.windll.kernel32.TerminateProcess(int(TSS_Handle._handle), -1) #
Terminate the TSS_Log

# END CODE




More information about the Python-list mailing list