[processing] swallow possible exceptions when reading console output from SAGA

This commit is contained in:
volaya 2015-05-20 06:15:42 +02:00
parent 960e6d84f9
commit 57d21c8383

View File

@ -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]
@ -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)