From 992048ede38142e8b80d0367a7b25e5c4958f1a7 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Sun, 27 Feb 2022 13:50:59 +0700 Subject: [PATCH] Use create_subprocess_shell and fix hosts file appending on Linux --- setup.py | 2 +- worthless/linux.py | 4 ++-- worthless/patcher.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 5b93ae6..7f0b99e 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='1.2.9-2', + version='1.2.9-3', packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], url='https://git.froggi.es/tretrauit/worthless-launcher', license='MIT License', diff --git a/worthless/linux.py b/worthless/linux.py index 72cfe1f..61c7b28 100644 --- a/worthless/linux.py +++ b/worthless/linux.py @@ -26,11 +26,11 @@ class LinuxUtils: """ if isinstance(file_path, Path): file_path = str(file_path) - await self._exec_command('pkexec echo {} > {}'.format(text, file_path)) + await self._exec_command('echo -e "{}" | pkexec tee {}'.format(text, file_path)) async def append_text_to_file(self, text, file_path: str | Path): """Append text to a file using pkexec (friendly gui) """ if isinstance(file_path, Path): file_path = str(file_path) - await self._exec_command('pkexec echo {} >> {}'.format(text, file_path)) + await self._exec_command('echo -e "{}" | pkexec tee -a {}'.format(text, file_path)) diff --git a/worthless/patcher.py b/worthless/patcher.py index fb16e85..cee858e 100644 --- a/worthless/patcher.py +++ b/worthless/patcher.py @@ -128,7 +128,7 @@ class Patcher: telemetry = await self.is_telemetry_blocked() if not telemetry: raise ValueError("All telemetry are blocked") - telemetry_hosts = "" + telemetry_hosts = "\n" for url in telemetry: telemetry_hosts += "0.0.0.0 " + url + "\n" match platform.system():