subprocess terminate help

Ernesto erniedude at gmail.com
Wed Nov 16 16:04:28 EST 2005


def launchWithoutConsole(command, args):
    """Launches 'command' windowless and waits until finished"""
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    return subprocess.Popen([command] + args,
startupinfo=startupinfo).wait()


handle = launchWithoutConsole("program.exe",["disconnect"])
------------------------------------------------------------------------------------------------------------------------------

I've been searching for ways to terminate this process so I can exit my
program.  program.exe is a text based interface which I'm running with
python subprocess in a DOS command window.  I tried using 'sys.exit()'
to end my program, but nothing works.  I think I have to somehow
terminate the subprocesses I create.  Any suggestions?




More information about the Python-list mailing list