From: Collin Funk Date: Fri, 5 Apr 2024 03:32:55 +0000 (-0700) Subject: gnulib-tool.py: Fix 'consider-using-with' pylint warnings. X-Git-Tag: v1.0~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dd17159496fd4254cc6de63bf9bcaecd03e1384;p=thirdparty%2Fgnulib.git gnulib-tool.py: Fix 'consider-using-with' pylint warnings. * pygnulib/GLModuleSystem.py (GLModuleSystem.list): Use run() instead of Popen() from the subprocess module. This function handles cleanup internally instead of as a context manager via the 'with' statement. --- diff --git a/ChangeLog b/ChangeLog index 65ef87e264..390d8071ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-04-05 Collin Funk + + gnulib-tool.py: Fix 'consider-using-with' pylint warnings. + * pygnulib/GLModuleSystem.py (GLModuleSystem.list): Use run() instead of + Popen() from the subprocess module. This function handles cleanup + internally instead of as a context manager via the 'with' statement. + 2024-04-05 Bruno Haible Update for NetBSD 9.3 and 10.0. diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py index 1f5d536fe3..98a21c4696 100644 --- a/pygnulib/GLModuleSystem.py +++ b/pygnulib/GLModuleSystem.py @@ -136,16 +136,14 @@ class GLModuleSystem: # Read modules from gnulib root directory. os.chdir(constants.DIRS['root']) - find = sp.Popen(find_args, stdout=sp.PIPE) - result += find.stdout.read().decode("UTF-8") + result += sp.run(find_args, text=True, capture_output=True, check=False).stdout os.chdir(DIRS['cwd']) # Read modules from local directories. if len(localpath) > 0: for localdir in localpath: os.chdir(localdir) - find = sp.Popen(find_args, stdout=sp.PIPE) - result += find.stdout.read().decode("UTF-8") + result += sp.run(find_args, text=True, capture_output=True, check=False).stdout os.chdir(DIRS['cwd']) listing = [ line