From 9dd17159496fd4254cc6de63bf9bcaecd03e1384 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Thu, 4 Apr 2024 20:32:55 -0700 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ pygnulib/GLModuleSystem.py | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) 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 -- 2.39.5