Skip to content

Commit

Permalink
streaming work
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Mar 18, 2018
1 parent 339802c commit 02327ae
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Content/Scripts/upycmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,27 @@ def run(process, path=_PythonHomePath, verbose=True):
ue.log(stdoutdata[1])
return stdoutdata[1] #return the data for dependent functions

def runStreaming(process, callback=None, path=_PythonHomePath, verbose=True):
#todo: change folder
fullcommand = FolderCommand(path) + process

if verbose:
print("Started cmd <" + fullcommand + ">")

#streaming version
popenobj = subprocess.Popen(fullcommand, stdout=subprocess.PIPE)
output = ''
for line in iter(process.stdout.readline, ''):
#sys.stdout.write(line)
print(line)
output += line


if verbose:
print("cmd Result: ")
print(output)
return output #return the data for dependent functions

#convenience override
def runLogOutput(process, path=_PythonHomePath):
fullcommand = FolderCommand(path) + process
Expand Down

0 comments on commit 02327ae

Please sign in to comment.