Skip to content

Commit

Permalink
Fix spacectl race on terminal state when reading logs (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinwyszynski authored May 2, 2022
1 parent a05faa4 commit b017e9f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/cmd/stack/run_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func runLogs(ctx context.Context, stack, run string) (terminal *structs.RunState

go func() {
terminal, err = runStates(ctx, stack, run, lines)
close(lines)
}()

for line := range lines {
Expand All @@ -27,8 +28,6 @@ func runLogs(ctx context.Context, stack, run string) (terminal *structs.RunState
}

func runStates(ctx context.Context, stack, run string, sink chan<- string) (*structs.RunStateTransition, error) {
defer func() { close(sink) }()

var query struct {
Stack *struct {
Run *struct {
Expand Down

0 comments on commit b017e9f

Please sign in to comment.