fix(cli): follow logs only when agent is starting (#13864)

This commit is contained in:
Mathias Fredriksson
2024-07-10 15:39:43 +03:00
committed by GitHub
parent 70046ea08d
commit c8484b4fc8
2 changed files with 3 additions and 4 deletions

View File

@ -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)"
}

View File

@ -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",
},