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
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitd259dcc

Browse files
committed
AcivityWriter
1 parent4115a09 commitd259dcc

File tree

3 files changed

+22
-38
lines changed

3 files changed

+22
-38
lines changed

‎cmd/coder/shell.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
147147
stdin:=process.Stdin()
148148
deferstdin.Close()
149149

150-
ap:=&activity.Pusher{Source:"ssh",EnvID:env.ID,Client:entClient}
150+
ap:=&activity.Pusher{Source:sshActivityName,EnvID:env.ID,Client:entClient}
151151
deferap.Start()()
152152

153-
_,err:=activity.Copy(ap,stdin,os.Stdin)
153+
wr:=activity.Writer(ap,stdin)
154+
_,err:=io.Copy(wr,os.Stdin)
154155
iferr!=nil {
155156
cancel()
156157
}
@@ -173,3 +174,5 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
173174
}
174175
returnerr
175176
}
177+
178+
constsshActivityName="ssh"

‎internal/activity/copy.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎internal/activity/writer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package activity
2+
3+
import"io"
4+
5+
typeactivityWriterstruct {
6+
p*Pusher
7+
wr io.Writer
8+
}
9+
10+
func (w*activityWriter)Write(p []byte) (nint,errerror) {
11+
w.p.Push()
12+
returnw.wr.Write(p)
13+
}
14+
15+
funcWriter(p*Pusher,wr io.Writer) io.Writer {
16+
return&activityWriter{p:p,wr:wr}
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp