Skip to content
Permalink
Browse files

[pyqgis-console] fix interrupted system call on run script for osx

  • Loading branch information
slarosa committed Apr 16, 2013
1 parent 256d28e commit b67d360fc59e90619da433a736f308bc325d9cc9
Showing with 16 additions and 2 deletions.
  1. +16 −2 python/console/console_editor.py
@@ -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:

0 comments on commit b67d360

Please sign in to comment.
You can’t perform that action at this time.