Skip to content

Commit

Permalink
Merge pull request #285 from callowayproject/284-enforce-utf8-encoding
Browse files Browse the repository at this point in the history
Fixes #284. Add UTF-8 encoding to subprocess.run in run_command
  • Loading branch information
coordt authored Jan 30, 2025
2 parents 5dde40f + cd2b193 commit cfd0b69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Test

on:
pull_request:
Expand Down
6 changes: 4 additions & 2 deletions bumpversion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ def format_and_raise_error(exc: Union[TypeError, subprocess.CalledProcessError])

def run_command(command: list, env: Optional[dict] = None) -> CompletedProcess:
"""Run a shell command and return its output."""
result = subprocess.run(command, text=True, check=True, capture_output=True, env=env) # NOQA: S603
result = subprocess.run( # NOQA: S603
command, text=True, check=True, capture_output=True, env=env, encoding="utf-8"
)
result.check_returncode()
return result


def is_subpath(parent: Path | str, path: Path | str) -> bool:
def is_subpath(parent: Union[Path, str], path: Union[Path, str]) -> bool:
"""Return whether a path is inside the parent."""
normalized_parent = Path(parent)
normalized_path = Path(path)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Version Control",
"Topic :: System :: Software Distribution",
]
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { file = "LICENSE" }
keywords = ["bumpversion", "version", "release"]
dynamic = ["version"]
Expand Down

0 comments on commit cfd0b69

Please sign in to comment.