From 5f89ac37226e454e43995e5f816fa53d7af6fa68 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 10 Jul 2024 14:10:05 +0300 Subject: [PATCH] fix(cli): only follow logs if agent is starting when using ssh --- cli/cliui/agent.go | 2 +- cli/cliui/agent_test.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/cliui/agent.go b/cli/cliui/agent.go index 0ebc371891cb6..ac254955dfe6b 100644 --- a/cli/cliui/agent.go +++ b/cli/cliui/agent.go @@ -132,7 +132,7 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO } stage := "Running workspace agent startup scripts" - follow := opts.Wait + follow := opts.Wait && agent.LifecycleState.Starting() if !follow { stage += " (non-blocking)" } diff --git a/cli/cliui/agent_test.go b/cli/cliui/agent_test.go index 43d135db2c2be..47c9d21900751 100644 --- a/cli/cliui/agent_test.go +++ b/cli/cliui/agent_test.go @@ -258,10 +258,9 @@ func TestAgent(t *testing.T) { }, }, want: []string{ - "⧗ Running workspace agent startup scripts", - "ℹ︎ To connect immediately, reconnect with --wait=no or CODER_SSH_WAIT=no, see --help for more information.", + "⧗ Running workspace agent startup scripts (non-blocking)", "Hello world", - "✘ Running workspace agent startup scripts", + "✘ Running workspace agent startup scripts (non-blocking)", "Warning: A startup script exited with an error and your workspace may be incomplete.", "For more information and troubleshooting, see", },