From abacf8db1cac8a32745d3b68cf809d74cf5d5637 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Mon, 11 Nov 2024 14:31:26 +0000 Subject: [PATCH] fix(agent/reconnectingpty): generate rpty id before starting lifecycle --- agent/reconnectingpty/screen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/reconnectingpty/screen.go b/agent/reconnectingpty/screen.go index c6d56aa220d4b..3fc93d88102f8 100644 --- a/agent/reconnectingpty/screen.go +++ b/agent/reconnectingpty/screen.go @@ -67,8 +67,6 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog. timeout: options.Timeout, } - go rpty.lifecycle(ctx, logger) - // Socket paths are limited to around 100 characters on Linux and macOS which // depending on the temporary directory can be a problem. To give more leeway // use a short ID. @@ -80,6 +78,8 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog. } rpty.id = hex.EncodeToString(buf) + go rpty.lifecycle(ctx, logger) + settings := []string{ // Disable the startup message that appears for five seconds. "startup_message off",