forked from Mirrors/bubbletea
fix: don't close stdin
This allows programs to re-use stdin after the tea.Program has finished. Fixes #595.
This commit is contained in:
parent
e079831c31
commit
9c20a804d7
6
tea.go
6
tea.go
|
@ -345,6 +345,7 @@ func (p *Program) Run() (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):
|
||||||
|
@ -364,11 +365,8 @@ func (p *Program) Run() (Model, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return p.initialModel, err
|
return p.initialModel, err
|
||||||
}
|
}
|
||||||
p.input = f
|
|
||||||
}
|
|
||||||
|
|
||||||
if f, ok := p.input.(io.ReadCloser); ok {
|
|
||||||
defer f.Close() //nolint:errcheck
|
defer f.Close() //nolint:errcheck
|
||||||
|
p.input = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle signals.
|
// Handle signals.
|
||||||
|
|
Loading…
Reference in New Issue