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

test: prevent TestAgent_ReconnectingPTY connection reporting check from interfering#20210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 1 commit intomainfromspike/internal-572-rpty-screen
Oct 8, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletionagent/agent_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1807,11 +1807,12 @@ func TestAgent_ReconnectingPTY(t *testing.T) {

//nolint:dogsled
conn, agentClient, _, _, _ := setupAgent(t, agentsdk.Manifest{}, 0)
idConnectionReport := uuid.New()
id := uuid.New()

// Test that the connection is reported. This must be tested in the
// first connection because we care about verifying all of these.
netConn0, err := conn.ReconnectingPTY(ctx,id, 80, 80, "bash --norc")
netConn0, err := conn.ReconnectingPTY(ctx,idConnectionReport, 80, 80, "bash --norc")
require.NoError(t, err)
_ = netConn0.Close()
assertConnectionReport(t, agentClient, proto.Connection_RECONNECTING_PTY, 0, "")
Expand Down
5 changes: 5 additions & 0 deletionsagent/reconnectingpty/screen.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ import (

// screenReconnectingPTY provides a reconnectable PTY via `screen`.
type screenReconnectingPTY struct {
logger slog.Logger
execer agentexec.Execer
command *pty.Cmd

Expand DownExpand Up@@ -62,6 +63,7 @@ type screenReconnectingPTY struct {
// own which causes it to spawn with the specified size.
func newScreen(ctx context.Context, logger slog.Logger, execer agentexec.Execer, cmd *pty.Cmd, options *Options) *screenReconnectingPTY {
rpty := &screenReconnectingPTY{
logger: logger,
execer: execer,
command: cmd,
metrics: options.Metrics,
Expand DownExpand Up@@ -173,6 +175,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne

ptty, process, err := rpty.doAttach(ctx, conn, height, width, logger)
if err != nil {
logger.Debug(ctx, "unable to attach to screen reconnecting pty", slog.Error(err))
if errors.Is(err, context.Canceled) {
// Likely the process was too short-lived and canceled the version command.
// TODO: Is it worth distinguishing between that and a cancel from the
Expand All@@ -182,6 +185,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
}
return err
}
logger.Debug(ctx, "attached to screen reconnecting pty")

defer func() {
// Log only for debugging since the process might have already exited on its
Expand DownExpand Up@@ -403,6 +407,7 @@ func (rpty *screenReconnectingPTY) Wait() {
}

func (rpty *screenReconnectingPTY) Close(err error) {
rpty.logger.Debug(context.Background(), "closing screen reconnecting pty", slog.Error(err))
// The closing state change will be handled by the lifecycle.
rpty.state.setState(StateClosing, err)
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp