tools: prefer filter to remove empty strings

Ref: https://github.com/nodejs/node/pull/23585#issuecomment-430585490

Python's `list.remove` will throw if the element is not found and also
it removes only the first occurrence.

This patch replaces the use of `list.remove` with a `filter` which
solves both of the above mentioned problems.

PR-URL: https://github.com/nodejs/node/pull/23727
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Sakthipriyan Vairamani (thefourtheye) 2018-10-18 10:29:07 +05:30 committed by Refael Ackermann
parent 9c82a1e7ba
commit 1d152b6e51

View File

@ -1381,8 +1381,8 @@ def ProcessOptions(options):
options.arch = options.arch.split(',')
options.mode = options.mode.split(',')
options.run = options.run.split(',')
options.skip_tests = options.skip_tests.split(',')
options.skip_tests.remove("")
# Split at commas and filter out all the empty strings.
options.skip_tests = filter(bool, options.skip_tests.split(','))
if options.run == [""]:
options.run = None
elif len(options.run) != 2: