win_exec.py 文件源码

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

项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码
def do_createprocess_exe(self,FILEPATH=None):
        if FILEPATH==None:
            FILEPATH = self.filepath
        exe_path = os.path.dirname(FILEPATH)
        exe_file = FILEPATH.split('\\')[-1]
        os.chdir(exe_path)
        try:
            handle = win32process.CreateProcess(
                os.path.join(exe_path, exe_file),
                '', None, None, 0,
                win32process.CREATE_NO_WINDOW,
                None ,
                exe_path,
                win32process.STARTUPINFO())
            self.running = True

        except Exception, e:
            print "Create Error!"
            handle  = None
            self.running = False
        '''    
        while self.running :
            rc = win32event.WaitForSingleObject(handle[0], 1000)
            if rc == win32event.WAIT_OBJECT_0:
                self.running = False
        '''
        print "GoodBye"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号