mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
feat: make signal handler optional
You can now initialize a tea app without a signal handler: p := NewProgram(model, WithoutSignalHandler())
This commit is contained in:
8
tea.go
8
tea.go
@@ -71,6 +71,7 @@ const (
|
||||
withInputTTY
|
||||
withCustomInput
|
||||
withANSICompressor
|
||||
withoutSignalHandler
|
||||
)
|
||||
|
||||
// Program is a terminal user interface.
|
||||
@@ -375,7 +376,12 @@ func (p *Program) StartReturningModel() (Model, error) {
|
||||
}
|
||||
|
||||
// Handle signals.
|
||||
sigintLoopDone := p.handleSignals()
|
||||
sigintLoopDone := make(chan struct{})
|
||||
if !p.startupOptions.has(withoutSignalHandler) {
|
||||
sigintLoopDone = p.handleSignals()
|
||||
} else {
|
||||
close(sigintLoopDone)
|
||||
}
|
||||
|
||||
if p.CatchPanics {
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user