Skip to content

Commit 0484769

Browse files
committedNov 7, 2016
[processing] Use subprocess.DEVNULL instead of open(os.devnull)
1 parent 6a99017 commit 0484769

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed
 

‎python/plugins/processing/algs/gdal/GdalUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def runGdal(commands, progress=None):
8787
fused_command,
8888
shell=True,
8989
stdout=subprocess.PIPE,
90-
stdin=open(os.devnull),
90+
stdin=subprocess.DEVNULL,
9191
stderr=subprocess.STDOUT,
9292
universal_newlines=True,
9393
).stdout

‎python/plugins/processing/algs/grass/GrassUtils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def executeGrass(commands, progress, outputCommands=None):
277277
command,
278278
shell=True,
279279
stdout=subprocess.PIPE,
280-
stdin=open(os.devnull),
280+
stdin=subprocess.DEVNULL,
281281
stderr=subprocess.STDOUT,
282282
universal_newlines=True,
283283
env=grassenv
@@ -307,7 +307,7 @@ def executeGrass(commands, progress, outputCommands=None):
307307
command,
308308
shell=True,
309309
stdout=subprocess.PIPE,
310-
stdin=open(os.devnull),
310+
stdin=subprocess.DEVNULL,
311311
stderr=subprocess.STDOUT,
312312
universal_newlines=True,
313313
env=grassenv

‎python/plugins/processing/algs/grass7/Grass7Utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def executeGrass7(commands, progress, outputCommands=None):
258258
command,
259259
shell=True,
260260
stdout=subprocess.PIPE,
261-
stdin=open(os.devnull),
261+
stdin=subprocess.DEVNULL,
262262
stderr=subprocess.STDOUT,
263263
universal_newlines=True,
264264
env=grassenv
@@ -287,7 +287,7 @@ def executeGrass7(commands, progress, outputCommands=None):
287287
command,
288288
shell=True,
289289
stdout=subprocess.PIPE,
290-
stdin=open(os.devnull),
290+
stdin=subprocess.DEVNULL,
291291
stderr=subprocess.STDOUT,
292292
universal_newlines=True,
293293
env=grassenv

‎python/plugins/processing/algs/lidar/fusion/FusionUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def runFusion(commands, progress):
6868
commands,
6969
shell=True,
7070
stdout=subprocess.PIPE,
71-
stdin=open(os.devnull),
71+
stdin=subprocess.DEVNULL,
7272
stderr=subprocess.STDOUT,
7373
universal_newlines=False,
7474
).stdout

‎python/plugins/processing/algs/lidar/lastools/LAStoolsUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def runLAStools(commands, progress):
7171
loglines.append(QCoreApplication.translate("LAStoolsUtils", "LAStools command line"))
7272
loglines.append(commandline)
7373
loglines.append(QCoreApplication.translate("LAStoolsUtils", "LAStools console output"))
74-
proc = subprocess.Popen(commandline, shell=True, stdout=subprocess.PIPE, stdin=open(os.devnull),
74+
proc = subprocess.Popen(commandline, shell=True, stdout=subprocess.PIPE, stdin=subprocess.DEVNULL,
7575
stderr=subprocess.STDOUT, universal_newlines=False).stdout
7676
for line in iter(proc.readline, ""):
7777
loglines.append(line)

‎python/plugins/processing/algs/otb/OTBUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def executeOtb(commands, progress, addToLog=True):
161161
loglines.append(tr("OTB execution console output"))
162162
os.putenv('ITK_AUTOLOAD_PATH', otbLibPath())
163163
fused_command = ''.join(['"%s" ' % re.sub(r'^"|"$', '', c) for c in commands])
164-
proc = subprocess.Popen(fused_command, shell=True, stdout=subprocess.PIPE, stdin=open(os.devnull), stderr=subprocess.STDOUT, universal_newlines=True).stdout
164+
proc = subprocess.Popen(fused_command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.DEVNULL, stderr=subprocess.STDOUT, universal_newlines=True).stdout
165165
if isMac(): # This trick avoids having an uninterrupted system call exception if OTB is not installed
166166
time.sleep(1)
167167
for line in iter(proc.readline, ""):

‎python/plugins/processing/algs/r/RUtils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def executeRAlgorithm(alg, progress):
146146
command,
147147
shell=True,
148148
stdout=subprocess.PIPE,
149-
stdin=open(os.devnull),
149+
stdin=subprocess.DEVNULL,
150150
stderr=subprocess.STDOUT,
151151
universal_newlines=True,
152152
)
@@ -213,7 +213,7 @@ def checkRIsInstalled(ignoreRegistrySettings=False):
213213
command,
214214
shell=True,
215215
stdout=subprocess.PIPE,
216-
stdin=open(os.devnull),
216+
stdin=subprocess.DEVNULL,
217217
stderr=subprocess.STDOUT,
218218
universal_newlines=True,
219219
).stdout

‎python/plugins/processing/algs/saga/SagaDescriptionCreator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def createLibraryFiles(self):
4444
command,
4545
shell=True,
4646
stdout=f2,
47-
stdin=open(os.devnull),
47+
stdin=subprocess.DEVNULL,
4848
stderr=subprocess.STDOUT,
4949
universal_newlines=True,
5050
)
@@ -81,7 +81,7 @@ def createDescriptionFiles(self):
8181
command,
8282
shell=True,
8383
stdout=f,
84-
stdin=open(os.devnull),
84+
stdin=subprocess.DEVNULL,
8585
stderr=f,
8686
universal_newlines=True,
8787
)

‎python/plugins/processing/algs/saga/SagaUtils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def getSagaInstalledVersion(runSaga=False):
132132
commands,
133133
shell=True,
134134
stdout=subprocess.PIPE,
135-
stdin=open(os.devnull),
135+
stdin=subprocess.DEVNULL,
136136
stderr=subprocess.STDOUT,
137137
universal_newlines=True,
138138
).stdout
@@ -167,7 +167,7 @@ def executeSaga(progress):
167167
command,
168168
shell=True,
169169
stdout=subprocess.PIPE,
170-
stdin=open(os.devnull),
170+
stdin=subprocess.DEVNULL,
171171
stderr=subprocess.STDOUT,
172172
universal_newlines=True,
173173
).stdout

‎python/plugins/processing/algs/saga/versioncheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def testDescriptionFile(f):
8282
command,
8383
shell=True,
8484
stdout=subprocess.PIPE,
85-
stdin=open(os.devnull),
85+
stdin=subprocess.DEVNULL,
8686
stderr=subprocess.STDOUT,
8787
universal_newlines=True,
8888
).stdout

‎python/plugins/processing/algs/taudem/TauDEMUtils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def executeTauDEM(command, progress):
9494
fused_command,
9595
shell=True,
9696
stdout=subprocess.PIPE,
97-
stdin=open(os.devnull),
97+
stdin=subprocess.DEVNULL,
9898
stderr=subprocess.STDOUT,
9999
universal_newlines=True,
100100
).stdout

0 commit comments

Comments
 (0)
Please sign in to comment.