Skip to content

Commit

Permalink
fix(install_cli: manual_package_selection): force encoding when writi…
Browse files Browse the repository at this point in the history
…ng and reading temp file (fixes #836)
  • Loading branch information
actionless committed Aug 29, 2024
1 parent 1ba61ef commit ee41bf4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pikaur/install_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

from .args import parse_args, reconstruct_args
from .build import PackageBuild, PkgbuildChanged, clone_aur_repos
from .config import DECORATION, DiffPagerValues, PikaurConfig, UsingDynamicUsers
from .config import (
DECORATION,
DEFAULT_CONFIG_ENCODING,
DiffPagerValues,
PikaurConfig,
UsingDynamicUsers,
)
from .conflicts import find_aur_conflicts
from .exceptions import (
BuildError,
Expand Down Expand Up @@ -509,11 +515,11 @@ def parse_pkg_names(text: str) -> set[str]:
)
pkg_names_before = parse_pkg_names(text_before)
with NamedTemporaryFile() as tmp_file:
with open_file(tmp_file.name, "w") as write_file:
with open_file(tmp_file.name, "w", encoding=DEFAULT_CONFIG_ENCODING) as write_file:
write_file.write(text_before)
chown_to_current(Path(tmp_file.name))
edit_file(tmp_file.name)
with open_file(tmp_file.name, "r") as read_file:
with open_file(tmp_file.name, "r", encoding=DEFAULT_CONFIG_ENCODING) as read_file:
selected_packages = parse_pkg_names(read_file.read())

list_diff = selected_packages.difference(pkg_names_before)
Expand Down

0 comments on commit ee41bf4

Please sign in to comment.