BuiltInFunctions.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:Zeuz_Python_Node 作者: AutomationSolutionz 项目源码 文件源码
def kill_appium_on_windows(appium_server):
    ''' Killing Appium server on windows involves killing off it's children '''

    sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
    CommonUtil.ExecLog(sModuleInfo,"Function Start", 0)

    try:
        import psutil, signal

        for child in psutil.Process(appium_server.pid).children(recursive=True): # For eah child in process
            try:
                cpid = int(str(child.as_dict(attrs=['pid'])['pid']).replace("'", "")) # Get child PID
                CommonUtil.ExecLog(sModuleInfo,"Killing Appium child: %d" % cpid, 0)
                psutil.Process(cpid).send_signal(signal.SIGTERM) # Send kill to it
                #print h.terminate()
            except: pass
    except Exception:
        return CommonUtil.Exception_Handler(sys.exc_info(), None, "Error killing Appium and it's children")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号