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

Commit1a7fd26

Browse files
committed
Revert SSH conn handling
1 parent9936923 commit1a7fd26

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

‎agent/agent.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,13 @@ func (a *agent) run(ctx context.Context) error {
268268

269269
scriptDone:=make(chanerror,1)
270270
scriptStart:=time.Now()
271-
err=a.trackConnGoroutine(func() {
271+
err:=a.trackConnGoroutine(func() {
272272
deferclose(scriptDone)
273273
scriptDone<-a.runStartupScript(ctx,metadata.StartupScript)
274274
})
275+
iferr!=nil {
276+
returnxerrors.Errorf("track startup script: %w",err)
277+
}
275278
gofunc() {
276279
vartimeout<-chan time.Time
277280
// If timeout is zero, an older version of the coder
@@ -645,24 +648,15 @@ func (a *agent) init(ctx context.Context) {
645648
sshLogger.Info(ctx,"ssh connection ended",slog.Error(err))
646649
},
647650
Handler:func(session ssh.Session) {
648-
err:=a.trackConnGoroutine(func() {
649-
err:=a.handleSSHSession(session)
650-
varexitError*exec.ExitError
651-
ifxerrors.As(err,&exitError) {
652-
a.logger.Debug(ctx,"ssh session returned",slog.Error(exitError))
653-
_=session.Exit(exitError.ExitCode())
654-
return
655-
}
656-
iferr!=nil {
657-
a.logger.Warn(ctx,"ssh session failed",slog.Error(err))
658-
// This exit code is designed to be unlikely to be confused for a legit exit code
659-
// from the process.
660-
_=session.Exit(MagicSessionErrorCode)
661-
return
662-
}
663-
})
651+
err:=a.handleSSHSession(session)
652+
varexitError*exec.ExitError
653+
ifxerrors.As(err,&exitError) {
654+
a.logger.Debug(ctx,"ssh session returned",slog.Error(exitError))
655+
_=session.Exit(exitError.ExitCode())
656+
return
657+
}
664658
iferr!=nil {
665-
a.logger.Warn(ctx,"trackssh session failed",slog.Error(err))
659+
a.logger.Warn(ctx,"ssh session failed",slog.Error(err))
666660
// This exit code is designed to be unlikely to be confused for a legit exit code
667661
// from the process.
668662
_=session.Exit(MagicSessionErrorCode)

‎cli/root_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ExtractCommandPathsLoop:
121121

122122
got:=buf.Bytes()
123123
// Remove CRLF newlines (Windows).
124-
//got = bytes.ReplaceAll(got, []byte{'\r', '\n'}, []byte{'\n'})
124+
got=bytes.ReplaceAll(got, []byte{'\r','\n'}, []byte{'\n'})
125125

126126
// The `coder templates create --help` command prints the path
127127
// to the working directory (--directory flag default value).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp