Add feature to discover running tauri app and attach to pid#1
Open
eugeneoshepkov wants to merge 1 commit intodirvine:mainfrom
Open
Add feature to discover running tauri app and attach to pid#1eugeneoshepkov wants to merge 1 commit intodirvine:mainfrom
eugeneoshepkov wants to merge 1 commit intodirvine:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the ability to discover and attach to running Tauri applications by PID.
Overview
This update introduces two features to the project:
• Discovery of running Tauri applications on the system
• Ability to attach to an already running Tauri application by its process ID (PID)
Key Changes
New Tool Methods
• Added two new tool methods in server/index.js:
▫ find_running_apps: Finds running Tauri applications on the system.
▫ attach_to_app: Attaches to an already running Tauri application using its PID.
Rust Backend Enhancements (src/tools/process.rs)
• ProcessInfo Struct:
▫ Added is_attached flag to distinguish between processes started by the tool and those attached externally.
▫ Changed child from a required field to an Option to support attached processes that don’t have a child process handle.
• Process Management:
▫ Updated logic to prevent killing processes that were not started by the tool (i.e., attached processes).
▫ Added find_running_apps method to scan system processes and identify likely Tauri apps by name or command-line arguments.
▫ Added attach_to_app method to allow tracking and interacting with an existing process by PID, even if it wasn’t started by the tool.
Server Integration (src/server.rs)
• Registered the new tool methods (find_running_apps, attach_to_app) in the server’s method list and JSON-RPC interface.
• Implemented handlers for these methods, including input validation and error handling.
• Updated the tool listing to include the new methods and their input schemas.
Summary
With these changes, users can now:
• List all running Tauri applications on their system.
• Attach to any of these running applications by specifying its PID, allowing for monitoring or interaction even if the process was not started by this tool.
These features improve the flexibility and usability of the tool for managing Tauri applications.