Skip to content

Commit

Permalink
Update subprocess usage to use modern subprocess.run()
Browse files Browse the repository at this point in the history
https://docs.python.org/3/library/subprocess.html#subprocess.run

> The recommended approach to invoking subprocesses is to use the run()
> function for all use cases it can handle.
  • Loading branch information
jdufresne authored and DimitriPapadopoulos committed Oct 29, 2022
1 parent 7a08d9f commit 458de80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ def main(self, *args, count=True, std=False, **kwargs):
def run_codespell(args=(), cwd=None):
"""Run codespell."""
args = ('--count',) + args
proc = subprocess.Popen(
proc = subprocess.run(
['codespell'] + list(args), cwd=cwd,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stderr = proc.communicate()[1].decode('utf-8')
count = int(stderr.split('\n')[-2])
capture_output=True, encoding='utf-8')
count = int(proc.stderr.split('\n')[-2])
return count


Expand Down

0 comments on commit 458de80

Please sign in to comment.