[PR #9] [CLOSED] fix: ensure CLI process is properly terminated when quitting the app #27

Closed
opened 2026-02-27 16:46:49 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/router-for-me/EasyCLI/pull/9
Author: @benzntech
Created: 10/24/2025
Status: Closed

Base: mainHead: fix/process-cleanup-on-quit


📝 Commits (3)

  • 0dfecad fix: ensure CLI process is properly terminated when quitting the app
  • 1e8f821 Update src-tauri/src/main.rs
  • 65a353f fix: correct indentation and syntax in force kill block

📊 Changes

1 file changed (+52 additions, -0 deletions)

View changed files

📝 src-tauri/src/main.rs (+52 -0)

📄 Description

Problem

When quitting the app from the system tray, the CLIProxyAPI process sometimes remains running in the background, requiring manual cleanup.

Solution

This PR implements a more robust process cleanup mechanism in the stop_process_internal() function:

  1. Graceful termination attempt: Calls child.kill() to send termination signal
  2. Wait period: Waits up to 500ms (10 iterations × 50ms) for the process to exit gracefully
  3. Force kill: If the process is still running, uses platform-specific commands:
    • macOS/Linux: kill -9 <PID>
    • Windows: taskkill /F /PID <PID>
  4. Logging: Adds detailed logging for debugging process cleanup issues

Testing

  • Built and tested on macOS (aarch64)
  • Compilation successful with no errors
  • The fix ensures that the CLI process is always cleaned up when the user quits the application

Fixes the issue where CLI processes remain running after app quit


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/router-for-me/EasyCLI/pull/9 **Author:** [@benzntech](https://github.com/benzntech) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/process-cleanup-on-quit` --- ### 📝 Commits (3) - [`0dfecad`](https://github.com/router-for-me/EasyCLI/commit/0dfecad9098414183e012ca789dc88dd5a4932a8) fix: ensure CLI process is properly terminated when quitting the app - [`1e8f821`](https://github.com/router-for-me/EasyCLI/commit/1e8f821da917ca9e7b62190e7191d95c41199dd6) Update src-tauri/src/main.rs - [`65a353f`](https://github.com/router-for-me/EasyCLI/commit/65a353fbcf0bc78a164242d4ca6a5c4695e9060b) fix: correct indentation and syntax in force kill block ### 📊 Changes **1 file changed** (+52 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/main.rs` (+52 -0) </details> ### 📄 Description ## Problem When quitting the app from the system tray, the CLIProxyAPI process sometimes remains running in the background, requiring manual cleanup. ## Solution This PR implements a more robust process cleanup mechanism in the `stop_process_internal()` function: 1. **Graceful termination attempt**: Calls `child.kill()` to send termination signal 2. **Wait period**: Waits up to 500ms (10 iterations × 50ms) for the process to exit gracefully 3. **Force kill**: If the process is still running, uses platform-specific commands: - macOS/Linux: `kill -9 <PID>` - Windows: `taskkill /F /PID <PID>` 4. **Logging**: Adds detailed logging for debugging process cleanup issues ## Testing - Built and tested on macOS (aarch64) - Compilation successful with no errors - The fix ensures that the CLI process is always cleaned up when the user quits the application ## Related Issue Fixes the issue where CLI processes remain running after app quit --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 16:46:49 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/EasyCLI#27
No description provided.