Fix git clone race condition in Clone Repository dialog#4
Open
lucky7323 wants to merge 1 commit intoCortexLM:mainfrom
Open
Fix git clone race condition in Clone Repository dialog#4lucky7323 wants to merge 1 commit intoCortexLM:mainfrom
lucky7323 wants to merge 1 commit intoCortexLM:mainfrom
Conversation
- Replace unreliable 500ms timeout with proper terminal:created event - Add shell argument escaping to prevent command injection - Implement 10-second timeout with fallback for terminal creation - Improve error handling with user-facing notifications Fixes race condition where git clone commands were silently ignored when terminals took longer than 500ms to initialize. Addresses issue #21724
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.
Problem
The Clone Repository functionality suffered from a race condition where git clone commands were silently ignored when terminals took longer than 500ms to initialize. This led to users believing their clone operations succeeded when they actually failed.
Root Cause
The original implementation used an arbitrary 500ms
setTimeout()before sending the git clone command:If the terminal wasn't ready within exactly 500ms, the
terminal:write-activeevent would be sent to a non-existent or inactive terminal, causing the command to be silently ignored.Solution
Replace the arbitrary timeout with proper event-driven terminal ready detection:
terminal:createdevent from the backendTechnical Details
terminal:createdTauri event that's already handled in TerminalsContextTesting
terminal:createdevent exists and is handledThis fix ensures git clone operations are reliable and provides proper feedback to users when issues occur.
Fixes #21724