Use create_subprocess_shell and fix hosts file appending on Linux
This commit is contained in:
@ -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))
|
||||
|
||||
Reference in New Issue
Block a user