Skip to content

Commit

Permalink
[processing] fix to avoid interrupted system call exceptions in mac
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed May 23, 2016
1 parent f0527e4 commit 9074b14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/otb/OTBUtils.py
Expand Up @@ -30,6 +30,7 @@

import os
import re
import time
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication
import subprocess
Expand Down Expand Up @@ -160,6 +161,8 @@ def executeOtb(commands, progress, addToLog=True):
os.putenv('ITK_AUTOLOAD_PATH', otbLibPath())
fused_command = ''.join(['"%s" ' % re.sub(r'^"|"$', '', c) for c in commands])
proc = subprocess.Popen(fused_command, shell=True, stdout=subprocess.PIPE, stdin=open(os.devnull), stderr=subprocess.STDOUT, universal_newlines=True).stdout
if isMac(): #This trick avoids having an uninterrupted system call exception if OTB is not installed
time.sleep(1)
for line in iter(proc.readline, ""):
if "[*" in line:
idx = line.find("[*")
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/saga/SagaUtils.py
Expand Up @@ -28,6 +28,7 @@
import os
import stat
import subprocess
import time

from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import QgsApplication
Expand Down Expand Up @@ -133,6 +134,8 @@ def getSagaInstalledVersion(runSaga=False):
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
if isMac(): #This trick avoids having an uninterrupted system call exception if SAGA is not installed
time.sleep(1)
try:
lines = proc.readlines()
for line in lines:
Expand Down

1 comment on commit 9074b14

@m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented on 9074b14 May 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a similar issue here, I think it would be nice to align the workaround but I am not sure which one is better
09a2f9b

Please sign in to comment.