diff --git a/internal/cmd/stack/run_logs.go b/internal/cmd/stack/run_logs.go index fc77a00..979b62e 100644 --- a/internal/cmd/stack/run_logs.go +++ b/internal/cmd/stack/run_logs.go @@ -128,7 +128,7 @@ func runStates(ctx context.Context, stack, run string, sink chan<- string, acFn fmt.Println("") if transition.HasLogs { - if err := runStateLogs(ctx, stack, run, transition.State, transition.StateVersion, sink); err != nil { + if err := runStateLogs(ctx, stack, run, transition.State, transition.StateVersion, sink, transition.Terminal); err != nil { return nil, err } } @@ -152,7 +152,7 @@ func runStates(ctx context.Context, stack, run string, sink chan<- string, acFn } } -func runStateLogs(ctx context.Context, stack, run string, state structs.RunState, version int, sink chan<- string) error { +func runStateLogs(ctx context.Context, stack, run string, state structs.RunState, version int, sink chan<- string, stateTerminal bool) error { var query struct { Stack *struct { Run *struct { @@ -204,7 +204,7 @@ func runStateLogs(ctx context.Context, stack, run string, state structs.RunState sink <- message.Body } - if logs.Finished { + if logs.Finished || (!logs.HasMore && stateTerminal) { break }