Skip to content

Commit

Permalink
[processing] redirect output from command line tools to Info tab (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Nov 22, 2014
1 parent 6637796 commit cefc4df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/processing/algs/gdal/GdalUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def runGdal(commands, progress):
loglines = []
loglines.append('GDAL execution console output')
fused_command = ''.join(['%s ' % c for c in commands])
print fused_command
progress.setInfo('GDAL command:')
progress.setCommand(fused_command)
proc = subprocess.Popen(
fused_command,
shell=True,
Expand All @@ -78,8 +79,9 @@ def runGdal(commands, progress):
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
progress.setInfo('GDAL command output:')
for line in iter(proc.readline, ''):
print line
progress.setConsoleInfo(line)
loglines.append(line)
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
GdalUtils.consoleOutput = loglines
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/grass/GrassUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def executeGrass(commands, progress, outputCommands=None):
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
progress.setInfo('GRASS commands output:')
for line in iter(proc.readline, ''):
if 'GRASS_INFO_PERCENT' in line:
try:
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/taudem/TauDEMUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def executeTauDEM(command, progress):
loglines = []
loglines.append('TauDEM execution console output')
fused_command = ''.join(['"%s" ' % c for c in command])
progress.setInfo('TauDEM command:')
progress.setCommand(fused_command.replace('" "', ' ').strip('"'))
proc = subprocess.Popen(
fused_command,
shell=True,
Expand All @@ -91,5 +93,6 @@ def executeTauDEM(command, progress):
universal_newlines=True,
).stdout
for line in iter(proc.readline, ''):
progress.setConsoleInfo(line)
loglines.append(line)
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)

0 comments on commit cefc4df

Please sign in to comment.