Skip to content
Myr

fix: don't close stdin

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

This allows programs to re-use stdin after the tea.Program has finished. Fixes #595.

authored by Christian Muehlhaeuser · committed by Christian Muehlhaeuser · parent e079831 · Browse files · 1 file+2 added−4 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+2 added−4 removed

  • other:+2 added−4 removed

1 file+2 added−4 removed

modified:tea.go+2 added-4 removed
343 unmodified lines
344 f, err := openInputTTY()345 if err != nil {346 return p.initialModel, err347 }348 defer f.Close() //nolint:errcheck349 p.input = f350351 case !p.startupOptions.has(withCustomInput):352 // If the user hasn't set a custom input, and input's not a terminal,
11 unmodified lines
364 f, err := openInputTTY()365 if err != nil {366 return p.initialModel, err367 }368 defer f.Close() //nolint:errcheck369 p.input = f370 }371370 if f, ok := p.input.(io.ReadCloser); ok {371 defer f.Close() //nolint:errcheck372 }373372 // Handle signals.373 if !p.startupOptions.has(withoutSignalHandler) {374 handlers.add(p.handleSignals())375 }
247 unmodified lines