本文整理汇总了Python中ShareYourSystem.stdout方法的典型用法代码示例。如果您正苦于以下问题:Python ShareYourSystem.stdout方法的具体用法?Python ShareYourSystem.stdout怎么用?Python ShareYourSystem.stdout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShareYourSystem
的用法示例。
在下文中一共展示了ShareYourSystem.stdout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_process
# 需要导入模块: import ShareYourSystem [as 别名]
# 或者: from ShareYourSystem import stdout [as 别名]
def do_process(self):
# /##################/#
# Check for open
#
# Check
if self.ProcessingActionStr == "open":
# import
import subprocess
if self.ProcessingDirectStr:
# /##################/#
# Direct case
#
# popen
self.ProcessedPopenVariable = subprocess.Popen(
self.ProcessingBashStr.split(" "), shell=False, stdout=subprocess.PIPE, stdin=subprocess.PIPE
)
else:
# /##################/#
# Indirect case where we build a sh file and put in a text
#
# Define
ProcessedBashPathStr = self.FolderingPathVariable + ProcessFileStr + ".txt"
# Check
if os.path.isfile(ProcessedBashPathStr):
# debug
"""
self.debug('delete the previous')
"""
# 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
#.........这里部分代码省略.........