From 017668613c1606384661ee18487af800496db5a3 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 9 Jul 2024 13:23:25 +0300 Subject: [PATCH 1/2] chore(cli): show information about --wait=no for ssh Fixes #11923 --- cli/cliui/agent.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/cliui/agent.go b/cli/cliui/agent.go index 0a4e53c591948..a656fbd6820f3 100644 --- a/cli/cliui/agent.go +++ b/cli/cliui/agent.go @@ -137,6 +137,9 @@ func Agent(ctx context.Context, writer io.Writer, agentID uuid.UUID, opts AgentO stage += " (non-blocking)" } sw.Start(stage) + if follow { + sw.Log(time.Time{}, codersdk.LogLevelInfo, "==> ℹ︎ To connect immediately, reconnect with --wait=no or CODER_SSH_WAIT=no, see --help for more information.") + } err = func() error { // Use func because of defer in for loop. logStream, logsCloser, err := opts.FetchLogs(ctx, agent.ID, 0, follow) From 372749d06eb01a7563a64ff8b6af05b72ce656d3 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 9 Jul 2024 10:31:38 +0000 Subject: [PATCH 2/2] add test case --- cli/cliui/agent_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/cliui/agent_test.go b/cli/cliui/agent_test.go index 8cfa481e838e3..fb47c9f6895c3 100644 --- a/cli/cliui/agent_test.go +++ b/cli/cliui/agent_test.go @@ -226,6 +226,7 @@ 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.", "testing: Hello world", "Bye now", "✔ Running workspace agent startup scripts", @@ -255,6 +256,7 @@ 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.", "Hello world", "✘ Running workspace agent startup scripts", "Warning: A startup script exited with an error and your workspace may be incomplete.", @@ -306,6 +308,7 @@ 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.", "Hello world", "✔ Running workspace agent startup scripts", },