-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce likelihood of races between stdout and cooked stdin reads (#18326
) As explained in the comment on `_getViewportCursorPosition`, printing to stdout after initiating a cooked stdin reads is a race condition between the application and the terminal. But we can significantly reduce the likelihood of this being obvious with this change. Related to #18265 Possibly related to #18081 ## Validation Steps Performed Execute the following Go code and start typing: ```go package main import ( "fmt" "time" ) func main() { go func() { time.Sleep(50 * time.Millisecond) fmt.Printf("Here is a prompt! >") }() var text string fmt.Scanln(&text) } ``` Without this change the prompt will disappear, and with this change in place, it'll work as expected. ✅ (cherry picked from commit 1040035) Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWppag Service-Version: 1.22
- Loading branch information
Showing
3 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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