本文整理汇总了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")