fix: eliminate blocking calls causing startup freezes and UI hangs

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-11-20 10:55:35 +05:00
parent 80a2c06b5a
commit b2a1046f9d
3 changed files with 59 additions and 18 deletions

View File

@@ -39,7 +39,19 @@ def main():
if start_sh is None:
return
subprocess.run(start_sh + ["cli", "--initial"])
# Run the initial command asynchronously to avoid blocking startup
import threading
def run_initial_command():
try:
subprocess.run(start_sh + ["cli", "--initial"], timeout=10) # Add timeout to prevent hanging
except subprocess.TimeoutExpired:
logger.warning("Initial command timed out after 10 seconds")
except Exception as e:
logger.warning(f"Initial command failed: {e}")
# Start the initial command in a background thread to not block UI startup
initial_thread = threading.Thread(target=run_initial_command, daemon=True)
initial_thread.start()
app = QApplication(sys.argv)
app.setWindowIcon(QIcon.fromTheme(__app_id__))