Skip to content
Myr

chore: apply ProgramOptions before checking context

Before adoption: this commit came in with the history the project adopted, so no landing records it.

We don't need to set the background context if an outside context was supplied.

authored by Christian Muehlhaeuser · committed by Christian Muehlhaeuser · parent 280bc6f · Browse files · 1 file+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−6 removed

  • other:+5 added−6 removed

1 file+5 added−6 removed

modified:tea.go+5 added-6 removed
139 unmodified lines
140 input: os.Stdin,141 msgs: make(chan Msg),142 }143144 // Apply all options to the program.145 for _, opt := range opts {146 opt(p)147 }148149 // A context can be provided with a ProgramOption, but if none was provided150 // we'll use the default background context.151 if p.ctx == nil {152 p.ctx = context.Background()153 }149154 // Initialize context and teardown channel.155 p.ctx, p.cancel = context.WithCancel(p.ctx)156153 // Apply all options to the program.154 for _, opt := range opts {155 opt(p)156 }157157 // if no output was set, set it to stdout158 if p.output == nil {159 p.output = termenv.DefaultOutput()160
464 unmodified lines