Skip to content

Commit

Permalink
[processing] swallow possible exceptions when reading console output …
Browse files Browse the repository at this point in the history
…from SAGA
  • Loading branch information
volaya committed May 20, 2015
1 parent 960e6d8 commit 57d21c8
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions python/plugins/processing/algs/saga/SagaUtils.py
Expand Up @@ -121,7 +121,10 @@ def getSagaInstalledVersion(runSaga=False):
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
lines = proc.readlines()
try:
lines = proc.readlines()
except:
return None
for line in lines:
if line.startswith("SAGA Version:"):
_installedVersion = line[len("SAGA Version:"):].strip().split(" ")[0]
Expand All @@ -145,17 +148,20 @@ def executeSaga(progress):
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
for line in iter(proc.readline, ''):
if '%' in line:
s = ''.join([x for x in line if x.isdigit()])
try:
progress.setPercentage(int(s))
except:
pass
else:
line = line.strip()
if line != '/' and line != '-' and line != '\\' and line != '|':
loglines.append(line)
progress.setConsoleInfo(line)
try:
for line in iter(proc.readline, ''):
if '%' in line:
s = ''.join([x for x in line if x.isdigit()])
try:
progress.setPercentage(int(s))
except:
pass
else:
line = line.strip()
if line != '/' and line != '-' and line != '\\' and line != '|':
loglines.append(line)
progress.setConsoleInfo(line)
except:
pass
if ProcessingConfig.getSetting(SAGA_LOG_CONSOLE):
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)

0 comments on commit 57d21c8

Please sign in to comment.