forked from Mirrors/bubbletea
fix: close input on shutdown whenever possible
This commit is contained in:
parent
6477a53545
commit
fbb00cc71e
10
tea.go
10
tea.go
|
@ -351,9 +351,6 @@ func (p *Program) StartReturningModel() (Model, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return p.initialModel, err
|
return p.initialModel, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer f.Close() //nolint:errcheck
|
|
||||||
|
|
||||||
p.input = f
|
p.input = f
|
||||||
|
|
||||||
case !p.startupOptions.has(withCustomInput):
|
case !p.startupOptions.has(withCustomInput):
|
||||||
|
@ -373,12 +370,13 @@ func (p *Program) StartReturningModel() (Model, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return p.initialModel, err
|
return p.initialModel, err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer f.Close() //nolint:errcheck
|
|
||||||
|
|
||||||
p.input = f
|
p.input = f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f, ok := p.input.(io.ReadCloser); ok {
|
||||||
|
defer f.Close() //nolint:errcheck
|
||||||
|
}
|
||||||
|
|
||||||
// Handle signals.
|
// Handle signals.
|
||||||
if !p.startupOptions.has(withoutSignalHandler) {
|
if !p.startupOptions.has(withoutSignalHandler) {
|
||||||
handlers.add(p.handleSignals())
|
handlers.add(p.handleSignals())
|
||||||
|
|
Loading…
Reference in New Issue