[processing] Use subprocess.DEVNULL instead of open(os.devnull)

This commit is contained in:
Nyall Dawson 2016-11-07 12:13:18 +10:00
parent 6a99017bf0
commit 0484769b7d
11 changed files with 16 additions and 16 deletions

View File

@ -87,7 +87,7 @@ class GdalUtils(object):
fused_command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout

View File

@ -277,7 +277,7 @@ class GrassUtils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
env=grassenv
@ -307,7 +307,7 @@ class GrassUtils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
env=grassenv

View File

@ -258,7 +258,7 @@ class Grass7Utils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
env=grassenv
@ -287,7 +287,7 @@ class Grass7Utils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
env=grassenv

View File

@ -68,7 +68,7 @@ class FusionUtils(object):
commands,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=False,
).stdout

View File

@ -71,7 +71,7 @@ class LAStoolsUtils(object):
loglines.append(QCoreApplication.translate("LAStoolsUtils", "LAStools command line"))
loglines.append(commandline)
loglines.append(QCoreApplication.translate("LAStoolsUtils", "LAStools console output"))
proc = subprocess.Popen(commandline, shell=True, stdout=subprocess.PIPE, stdin=open(os.devnull),
proc = subprocess.Popen(commandline, shell=True, stdout=subprocess.PIPE, stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT, universal_newlines=False).stdout
for line in iter(proc.readline, ""):
loglines.append(line)

View File

@ -161,7 +161,7 @@ def executeOtb(commands, progress, addToLog=True):
loglines.append(tr("OTB execution console output"))
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
proc = subprocess.Popen(fused_command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.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, ""):

View File

@ -146,7 +146,7 @@ class RUtils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
@ -213,7 +213,7 @@ class RUtils(object):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout

View File

@ -44,7 +44,7 @@ class SagaDescriptionCreator(object):
command,
shell=True,
stdout=f2,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
@ -81,7 +81,7 @@ class SagaDescriptionCreator(object):
command,
shell=True,
stdout=f,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=f,
universal_newlines=True,
)

View File

@ -132,7 +132,7 @@ def getSagaInstalledVersion(runSaga=False):
commands,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
@ -167,7 +167,7 @@ def executeSaga(progress):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout

View File

@ -82,7 +82,7 @@ def testDescriptionFile(f):
command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout

View File

@ -94,7 +94,7 @@ class TauDEMUtils(object):
fused_command,
shell=True,
stdout=subprocess.PIPE,
stdin=open(os.devnull),
stdin=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout