diff --git a/tea.go b/tea.go index c822402..b9fc96b 100644 --- a/tea.go +++ b/tea.go @@ -351,9 +351,6 @@ func (p *Program) StartReturningModel() (Model, error) { if err != nil { return p.initialModel, err } - - defer f.Close() //nolint:errcheck - p.input = f case !p.startupOptions.has(withCustomInput): @@ -373,12 +370,13 @@ func (p *Program) StartReturningModel() (Model, error) { if err != nil { return p.initialModel, err } - - defer f.Close() //nolint:errcheck - p.input = f } + if f, ok := p.input.(io.ReadCloser); ok { + defer f.Close() //nolint:errcheck + } + // Handle signals. if !p.startupOptions.has(withoutSignalHandler) { handlers.add(p.handleSignals())