Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5fb9c33

Browse files
authored
fix: Fix ssh message/spinner in VSCode integrated terminal (#5000)
* fix: Fix ssh message/spinner in VSCode integrated terminalThe messages never show up in VSCode integrated terminal due to thedefer `fmt.Fprintf`. There could be a race in VSCode in handling theterminal codes but ultimately, we can simplify our logic by juststopping the spinner for the duration of the update.* Avoid race in starting spinner after exit
1 parente847276 commit5fb9c33

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎cli/cliui/agent.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
5858
return
5959
case<-stopSpin:
6060
}
61+
cancelFunc()
6162
signal.Stop(stopSpin)
6263
spin.Stop()
6364
// nolint:revive
@@ -83,10 +84,16 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
8384
}
8485
waitMessage=m
8586

86-
// This saves the cursor position, then defers clearing from the cursor
87-
// position to the end of the screen.
88-
_,_=fmt.Fprintf(writer,"\033[s\r\033[2K%s%s\n\n",moveUp,Styles.Paragraph.Render(Styles.Prompt.String()+waitMessage))
89-
deferfmt.Fprintf(writer,"\033[u\033[J")
87+
// Stop the spinner while we write our message.
88+
spin.Stop()
89+
// Clear the line and (if necessary) move up a line to write our message.
90+
_,_=fmt.Fprintf(writer,"\033[2K%s%s\n\n",moveUp,Styles.Paragraph.Render(Styles.Prompt.String()+waitMessage))
91+
select {
92+
case<-ctx.Done():
93+
default:
94+
// Safe to resume operation.
95+
spin.Start()
96+
}
9097
}
9198
gofunc() {
9299
select {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp