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

Commitb04a678

Browse files
committed
Fix coder sh freeze
1 parent38ef6de commitb04a678

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

‎cmd/coder/shell.go

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (cmd *shellCmd) Run(fl *pflag.FlagSet) {
9999
os.Exit(exitErr.Code)
100100
}
101101
iferr!=nil {
102-
flog.Fatal("run command: %v Isit online?",err)
102+
flog.Fatal("run command: %v. Is%q online?",err,envName)
103103
}
104104
}
105105

@@ -120,6 +120,9 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
120120
deferrestore()
121121
}
122122

123+
ctx,cancel:=context.WithCancel(ctx)
124+
defercancel()
125+
123126
conn,err:=entClient.DialWsep(ctx,env)
124127
iferr!=nil {
125128
returnerr
@@ -142,10 +145,26 @@ func runCommand(ctx context.Context, envName string, command string, args []stri
142145
gofunc() {
143146
stdin:=process.Stdin()
144147
deferstdin.Close()
145-
io.Copy(stdin,os.Stdin)
148+
_,err:=io.Copy(stdin,os.Stdin)
149+
iferr!=nil {
150+
cancel()
151+
}
146152
}()
147-
goio.Copy(os.Stdout,process.Stdout())
148-
goio.Copy(os.Stderr,process.Stderr())
149-
150-
returnprocess.Wait()
153+
gofunc() {
154+
_,err:=io.Copy(os.Stdout,process.Stdout())
155+
iferr!=nil {
156+
cancel()
157+
}
158+
}()
159+
gofunc() {
160+
_,err:=io.Copy(os.Stderr,process.Stderr())
161+
iferr!=nil {
162+
cancel()
163+
}
164+
}()
165+
err=process.Wait()
166+
ifxerrors.Is(err,ctx.Err()) {
167+
returnxerrors.Errorf("network error")
168+
}
169+
returnerr
151170
}

‎go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module cdr.dev/coder-cli
33
go1.14
44

55
require (
6-
cdr.dev/wsepv0.0.0-20200602025116-5cbe721683df
6+
cdr.dev/wsepv0.0.0-20200612224539-e66f8bb64883
77
github.com/fatih/colorv1.9.0// indirect
88
github.com/gorilla/websocketv1.4.1
99
github.com/kirsle/configdirv0.0.0-20170128060238-e45d2f54772f
10-
github.com/klauspost/compressv1.10.7// indirect
10+
github.com/klauspost/compressv1.10.8// indirect
1111
github.com/mattn/go-colorablev0.1.6// indirect
1212
github.com/pkg/browserv0.0.0-20180916011732-0a3d74bf9ce4
1313
github.com/rjeczalik/notifyv0.9.2
@@ -16,7 +16,7 @@ require (
1616
go.coder.com/flogv0.0.0-20190906214207-47dd47ea0512
1717
golang.org/x/cryptov0.0.0-20200422194213-44a606286825
1818
golang.org/x/syncv0.0.0-20200317015054-43a5402ce75a
19-
golang.org/x/sysv0.0.0-20200523222454-059865788121
19+
golang.org/x/sysv0.0.0-20200610111108-226ff32320da
2020
golang.org/x/timev0.0.0-20191024005414-555d28b269f0
2121
golang.org/x/xerrorsv0.0.0-20191204190536-9bdfabe68543
2222
nhooyr.io/websocketv1.8.6

‎go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ cdr.dev/slog v1.3.0 h1:MYN1BChIaVEGxdS7I5cpdyMC0+WfJfK8BETAfzfLUGQ=
22
cdr.dev/slogv1.3.0/go.mod h1:C5OL99WyuOK8YHZdYY57dAPN1jK2WJlCdq2VP6xeQns=
33
cdr.dev/wsepv0.0.0-20200602025116-5cbe721683df h1:9KgAywWKNQMYi3gvu4HyExiuXJhoNbnrPcb5RIzYSdQ=
44
cdr.dev/wsepv0.0.0-20200602025116-5cbe721683df/go.mod h1:2VKClUml3gfmLez0gBxTJIjSKszpQotc2ZqPdApfK/Y=
5+
cdr.dev/wsepv0.0.0-20200612224539-e66f8bb64883 h1:nr/trZU6911y9PohrsVaujzJPrtN7bUSX7yfvenYbc0=
6+
cdr.dev/wsepv0.0.0-20200612224539-e66f8bb64883/go.mod h1:2VKClUml3gfmLez0gBxTJIjSKszpQotc2ZqPdApfK/Y=
57
cloud.google.com/gov0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
68
cloud.google.com/gov0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
79
cloud.google.com/gov0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
@@ -118,6 +120,8 @@ github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eT
118120
github.com/klauspost/compressv1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
119121
github.com/klauspost/compressv1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg=
120122
github.com/klauspost/compressv1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
123+
github.com/klauspost/compressv1.10.8 h1:eLeJ3dr/Y9+XRfJT4l+8ZjmtB5RPJhucH2HeCV5+IZY=
124+
github.com/klauspost/compressv1.10.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
121125
github.com/kr/prettyv0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
122126
github.com/kr/prettyv0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
123127
github.com/kr/ptyv1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -240,6 +244,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
240244
golang.org/x/sysv0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
241245
golang.org/x/sysv0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o=
242246
golang.org/x/sysv0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
247+
golang.org/x/sysv0.0.0-20200610111108-226ff32320da h1:bGb80FudwxpeucJUjPYJXuJ8Hk91vNtfvrymzwiei38=
248+
golang.org/x/sysv0.0.0-20200610111108-226ff32320da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
243249
golang.org/x/textv0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
244250
golang.org/x/textv0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
245251
golang.org/x/textv0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp