mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
Fix subprocess unclosed file
This commit is contained in:
parent
5ef16bf659
commit
c3ad30da34
@ -254,7 +254,7 @@ class Grass7Utils(object):
|
||||
loglines.append(Grass7Utils.tr('GRASS GIS 7 execution console output'))
|
||||
grassOutDone = False
|
||||
command, grassenv = Grass7Utils.prepareGrass7Execution(commands)
|
||||
proc = subprocess.Popen(
|
||||
with subprocess.Popen(
|
||||
command,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
@ -262,8 +262,8 @@ class Grass7Utils(object):
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True,
|
||||
env=grassenv
|
||||
).stdout
|
||||
for line in iter(proc.readline, ''):
|
||||
) as proc:
|
||||
for line in iter(proc.stdout.readline, ''):
|
||||
if 'GRASS_INFO_PERCENT' in line:
|
||||
try:
|
||||
progress.setPercentage(int(line[len('GRASS_INFO_PERCENT') + 2:]))
|
||||
@ -283,7 +283,7 @@ class Grass7Utils(object):
|
||||
|
||||
if not grassOutDone and outputCommands:
|
||||
command, grassenv = Grass7Utils.prepareGrass7Execution(outputCommands)
|
||||
proc = subprocess.Popen(
|
||||
with subprocess.Popen(
|
||||
command,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
@ -291,8 +291,8 @@ class Grass7Utils(object):
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True,
|
||||
env=grassenv
|
||||
).stdout
|
||||
for line in iter(proc.readline, ''):
|
||||
) as proc:
|
||||
for line in iter(proc.stdout.readline, ''):
|
||||
if 'GRASS_INFO_PERCENT' in line:
|
||||
try:
|
||||
progress.setPercentage(int(
|
||||
|
Loading…
x
Reference in New Issue
Block a user