Skip to content

Commit

Permalink
[pyqgis-console] fix interrupted system call on run script for osx
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Apr 16, 2013
1 parent 256d28e commit b67d360
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions python/console/console_editor.py
Expand Up @@ -395,16 +395,30 @@ def runScriptCode(self):
else:
try:
p = subprocess.Popen(['python', filename], shell=False, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
traceback = p.stderr.read()
out = p.stdout.read()
out, traceback = p.communicate()

## Fix interrupted system call on OSX
if sys.platform == 'darwin':
status = None
while status is None:
try:
status = p.wait()
except OSError, e:
if e.errno == 4:
pass
else:
raise e

if traceback:
print "## %s" % datetime.datetime.now()
print "## Script error: %s" % name
sys.stderr.write(traceback)
p.stderr.close()
else:
print "## %s" % datetime.datetime.now()
print "## Script executed successfully: %s" % name
sys.stdout.write(out)
p.stdout.close()
del p
#execfile(unicode(filename))
except IOError, error:
Expand Down

0 comments on commit b67d360

Please sign in to comment.