From c8b4f3f8a6c7d4b12ddf0a98e73e05cd70164263 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 09:15:00 +0000 Subject: [PATCH 1/3] Initial plan From 6b26a2ea3a8eb8a02a65c4c07785f93d77571072 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 09:18:43 +0000 Subject: [PATCH 2/3] fix: actually terminate qoder process before reset Co-authored-by: VoDaiLocz <88762074+VoDaiLocz@users.noreply.github.com> --- qoder_reset_gui.py | 55 ++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/qoder_reset_gui.py b/qoder_reset_gui.py index 7c20ee5..6d411c8 100644 --- a/qoder_reset_gui.py +++ b/qoder_reset_gui.py @@ -732,40 +732,63 @@ def generate_system_version(self, system_type): patch = random.randint(0, 50) return f"{major}.{minor}.{patch}" - def close_qoder(self): + def close_qoder(self, skip_confirm=False): """Close Qoder application""" try: # Check if Qoder is running if not self.is_qoder_running(): self.log("Qoder is not running.") - return + return True # Confirm closing - reply = QMessageBox.question( - self, - self.tr('confirm_close_qoder'), - "Are you sure you want to close Qoder?", - QMessageBox.Yes | QMessageBox.No - ) + reply = QMessageBox.Yes + if not skip_confirm: + reply = QMessageBox.question( + self, + self.tr('confirm_close_qoder'), + "Are you sure you want to close Qoder?", + QMessageBox.Yes | QMessageBox.No + ) if reply == QMessageBox.Yes: - # Execute Qoder closing operation self.log("Closing Qoder...") + system = platform.system() + if system == "Windows": + subprocess.run( + ["taskkill", "/F", "/IM", "qoder.exe"], + capture_output=True, + text=True + ) + elif system == "Darwin": + subprocess.run(["pkill", "-x", "Qoder"], capture_output=True, text=True) + elif system == "Linux": + subprocess.run(["pkill", "-x", "qoder"], capture_output=True, text=True) + + if self.is_qoder_running(): + self.log("Failed to close Qoder process.") + QMessageBox.critical( + self, + self.tr('error'), + "Failed to close Qoder automatically. Please close it manually." + ) + return False - # Prompt successful closure QMessageBox.information( self, self.tr('success'), "Qoder has been closed successfully." ) + return True + + return False except Exception as e: - # Log error self.log(f"Error closing Qoder: {str(e)}") QMessageBox.critical( self, self.tr('error'), f"Failed to close Qoder: {str(e)}" ) + return False def login_identity_cleanup(self): """Clean login-related identity information""" @@ -970,15 +993,9 @@ def hardware_fingerprint_reset(self): def one_click_reset(self): """一键修改所有配置""" try: - # 检查Qoder是否在运行 if self.is_qoder_running(): - QMessageBox.warning( - self, - self.tr('warning'), - self.tr('qoder_detected_running') + "\n" + - self.tr('please_close_qoder') - ) - return + if not self.close_qoder(skip_confirm=True): + return # 确认操作 reply = QMessageBox.question( From 03ec7e1c99c090e3eac68fecaaa7dfd29109fd91 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 09:21:38 +0000 Subject: [PATCH 3/3] fix: properly terminate qoder process in reset flow Co-authored-by: VoDaiLocz <88762074+VoDaiLocz@users.noreply.github.com> --- qoder_reset_gui.py | 54 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/qoder_reset_gui.py b/qoder_reset_gui.py index 6d411c8..b643d27 100644 --- a/qoder_reset_gui.py +++ b/qoder_reset_gui.py @@ -16,9 +16,18 @@ import webbrowser import platform import random +import time from pathlib import Path from datetime import datetime, timedelta +# Small delay so OS process teardown completes before re-checking status. +PROCESS_TERMINATION_WAIT_SECONDS = 0.8 +QODER_PROCESS_NAME_BY_SYSTEM = { + "Windows": "qoder.exe", + "Darwin": "Qoder", + "Linux": "qoder" +} + try: from PyQt5.QtWidgets import * from PyQt5.QtCore import * @@ -753,16 +762,49 @@ def close_qoder(self, skip_confirm=False): if reply == QMessageBox.Yes: self.log("Closing Qoder...") system = platform.system() + kill_result = None + process_name = QODER_PROCESS_NAME_BY_SYSTEM.get(system) + if not process_name: + self.log(f"Unsupported platform for automatic close: {system}") + QMessageBox.critical( + self, + self.tr('error'), + "Automatic close is not supported on this platform. Please close Qoder manually." + ) + return False + if system == "Windows": - subprocess.run( - ["taskkill", "/F", "/IM", "qoder.exe"], + kill_result = subprocess.run( + ["taskkill", "/F", "/IM", process_name], + capture_output=True, + text=True + ) + elif system in ("Darwin", "Linux"): + kill_result = subprocess.run( + ["pkill", "-x", process_name], capture_output=True, text=True ) - elif system == "Darwin": - subprocess.run(["pkill", "-x", "Qoder"], capture_output=True, text=True) - elif system == "Linux": - subprocess.run(["pkill", "-x", "qoder"], capture_output=True, text=True) + + if kill_result is None: + self.log("Failed to execute close command.") + return False + + if kill_result.returncode != 0: + stderr_output = (kill_result.stderr or "").strip() + stdout_output = (kill_result.stdout or "").strip() + if stderr_output: + self.log(f"Close command stderr: {stderr_output}") + if stdout_output: + self.log(f"Close command stdout: {stdout_output}") + if not stderr_output and not stdout_output: + self.log(f"Close command failed with exit code {kill_result.returncode}") + else: + self.log(f"Close command exit code: {kill_result.returncode}") + else: + self.log("Close command executed successfully.") + + time.sleep(PROCESS_TERMINATION_WAIT_SECONDS) if self.is_qoder_running(): self.log("Failed to close Qoder process.")