本文介绍了子进程终止帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

def launchWithoutConsole(command,args):

"""启动''命令''无窗口并等待直到完成""

startupinfo = subprocess.STARTUPINFO()

startupinfo.dwFlags | = subprocess.STARTF_USESHOWWINDOW

返回subprocess.Popen([command] + args,

startupinfo = startupinfo).wait()

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

--------- -------------------------------------------------- -------------------------------------------------- -----------------


我一直在寻找终止这个过程的方法,所以我可以退出我的

计划。 program.exe是一个基于文本的界面,我在DOS命令窗口中运行了
python子进程。我尝试使用''sys.exit()''

来结束我的程序,但没有任何作用。我想我必须以某种方式

终止我创建的子进程。有什么建议吗?

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?

推荐答案




有人自称Ernesto昨天发布此链接:






someone calling himself "Ernesto" posted this link yesterday:

http://aspn.activestate.com/ASPN/Coo.../Recipe/347462

</F>





有人自称Ernesto昨天发布此链接:






someone calling himself "Ernesto" posted this link yesterday:

http://aspn.activestate.com/ASPN/Coo.../Recipe/347462

</F>



这篇关于子进程终止帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:40