当前位置: 首页>>代码示例>>Python>>正文


Python ShareYourSystem.wait方法代码示例

本文整理汇总了Python中ShareYourSystem.wait方法的典型用法代码示例。如果您正苦于以下问题:Python ShareYourSystem.wait方法的具体用法?Python ShareYourSystem.wait怎么用?Python ShareYourSystem.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShareYourSystem的用法示例。


在下文中一共展示了ShareYourSystem.wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_process

# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import wait [as 别名]

#.........这里部分代码省略.........
                    # rm
                    os.popen("rm " + ProcessedBashPathStr)

                    # set
                self.ProcessedBashStr = 'OUTPUT="$(' + self.ProcessingBashStr + ')"\n'
                self.ProcessedBashStr += 'echo "${OUTPUT}" > ' + ProcessedBashPathStr

                # debug
                """
				self.debug(
						[
							'We write the sh bash script',
							('self.',self,['ProcessedBashStr'])
						]
					)
				"""

                # write
                self.file(ProcessFileStr + ".sh", "w", _WriteVariable=self.ProcessedBashStr).file(_ModeStr="c")

                # debug
                """
				self.debug(
					[
						'We call the supprocess',
						('self.',self,[
											'FiledPathStr',
										])
					]
				)
				"""

                # kill the previous maybe
                if self.ProcessedPopenVariable != None:
                    self.ProcessedPopenVariable.kill()

                    # popen
                self.ProcessedPopenVariable = subprocess.Popen(
                    ["sh", self.FiledPathStr], shell=False, stdout=subprocess.PIPE, stdin=subprocess.PIPE
                )

                # debug
                """
				self.debug(
					[
						'We read the output',
					]
				)
				"""

                # wait for connect
                import time

                ProcessedReadBool = False
                ProcessedCountInt = 0
                while ProcessedReadBool == False and ProcessedCountInt < 5:

                    try:

                        # read
                        self.ProcessedBashStr = self.file(ProcessFileStr + ".txt", "r").FiledReadVariable

                        # set
                        ProcessedReadBool = True

                    except:

                        # debug
                        """
						self.debug(
							[
								'File read not work'
							]
						)
						"""

                        # say that it is not setted
                        ProcessedReadBool = False
                        ProcessedCountInt += 1
                        time.sleep(0.2)

                        # /##################/#
                        # Check for kill
                        #

        elif self.ProcessingActionStr == "kill":

            # kill the process
            if self.ProcessedPopenVariable != None:

                # debug
                """
				self.debug('kill the popen variable')
				"""

                # kill but before wait a bit to be sure that the db has time to refresh
                SYS.stdout("Kill the popen variable")
                SYS.wait(self.ProcessingTimeInt)
                self.ProcessedPopenVariable.kill()
                SYS.stdout("It is killed")
开发者ID:BinWang20140601,项目名称:ShareYourSystem,代码行数:104,代码来源:__init__.py


注:本文中的ShareYourSystem.wait方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。