Skip to content

Commit

Permalink
[processing] Fix exceptions on grass algorithms on Windows
Browse files Browse the repository at this point in the history
(cherry picked from commit 9b61eb8)
  • Loading branch information
juanmpd authored and nyalldawson committed Dec 4, 2018
1 parent 2e6ebb0 commit 0c36b90
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/plugins/processing/algs/grass7/Grass7Utils.py
Expand Up @@ -400,6 +400,11 @@ def executeGrass(commands, feedback, outputCommands=None):
# commands again.
if not grassOutDone and outputCommands:
command, grassenv = Grass7Utils.prepareGrassExecution(outputCommands)
# For MS-Windows, we need to hide the console window.
if isWindows():
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
si.wShowWindow = subprocess.SW_HIDE
with subprocess.Popen(
command,
shell=False,
Expand All @@ -408,6 +413,7 @@ def executeGrass(commands, feedback, outputCommands=None):
stderr=subprocess.STDOUT,
universal_newlines=True,
env=grassenv,
encoding="cp{}".format(Grass7Utils.getWindowsCodePage()) if isWindows() else None,
startupinfo=si if isWindows() else None
) as proc:
for line in iter(proc.stdout.readline, ''):
Expand Down

0 comments on commit 0c36b90

Please sign in to comment.