From e2963d46863a4237a9737efb09450da5be8bab25 Mon Sep 17 00:00:00 2001 From: "Mustafa D." <42353725+ciwga@users.noreply.github.com> Date: Sun, 22 Dec 2024 06:41:00 +0000 Subject: [PATCH] added creationflags parameter for subprocess. --- gui.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/gui.py b/gui.py index 6d5d932..3d2ace8 100644 --- a/gui.py +++ b/gui.py @@ -231,11 +231,11 @@ def flush(self) -> None: pass def start_adb(self) -> None: - """Start the ADB server (to be implemented).""" + """Start the ADB server (overridden in AndroidDebloater class).""" pass def stop_adb(self) -> None: - """Stop the ADB server (to be implemented).""" + """Stop the ADB server (overridden in AndroidDebloater class).""" pass def on_close(self) -> None: @@ -244,24 +244,20 @@ def on_close(self) -> None: self.root.destroy() def get_device_name(self) -> None: - """Get the device name (to be implemented).""" + """Get the device name (overridden in AndroidDebloater class).""" pass def load_applications(self) -> None: - """Load applications from the device (to be implemented).""" + """Load applications from the device (overridden in AndroidDebloater class).""" pass def debloat_selected(self, package_tree: ttk.Treeview = None) -> None: """ - Uninstall the selected applications. - - Args: - package_tree (ttk.Treeview, optional): The tree view containing the selected packages. - """ + Uninstall the selected applications. (overridden in AndroidDebloater class).""" pass def remove_apps_from_path(self) -> None: - """Remove applications listed in a text file (to be implemented).""" + """Remove applications listed in a text file (overridden in AndroidDebloater class).""" pass def update_app_tree(self) -> None: @@ -523,7 +519,8 @@ def _execute_command(self) -> None: stderr=subprocess.PIPE, text=True, bufsize=1, - universal_newlines=True + universal_newlines=True, + creationflags=subprocess.CREATE_NO_WINDOW ) threading.Thread(target=self._read_process_output, daemon=True).start() @@ -560,7 +557,12 @@ def _process_output(self) -> None: def _check_root_access(self) -> bool: """Check if the device has root access.""" check_command = [str(self.adb_path), "-s", self.device_id, "shell", "su", "-c", "echo rooted"] - result = subprocess.run(check_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + result = subprocess.run(check_command, + check=True, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + creationflags=subprocess.CREATE_NO_WINDOW) if "rooted" in result.stdout: return True self.terminal_text.insert(tk.END, "Root access is required for this command\n", "command_output") @@ -672,4 +674,4 @@ def get_package_tree(self) -> ttk.Treeview: Returns: ttk.Treeview: The tree view containing the packages. """ - return self.package_tree \ No newline at end of file + return self.package_tree