Skip to content
Myr

feat: allow to disable signals (#721)

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

authored by Carlos Alexandro Becker · committed by GitHub · parent 9cc3861 · Browse files · 2 files+15 added−0 removed
This commit

State

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

Trailers

  • Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

Diff stats

2 files+15 added−0 removed

  • other:+15 added−0 removed

2 files+15 added−0 removed

modified:options_test.go+7 added
33 unmodified lines
34 t.Errorf("expected renderer to be a nilRenderer, got %v", p.renderer)35 }36 })3738 t.Run("without signals", func(t *testing.T) {39 p := NewProgram(nil, WithoutSignals())40 if !p.ignoreSignals {41 t.Errorf("ignore signals should have been set")42 }43 })4445 t.Run("filter", func(t *testing.T) {46 p := NewProgram(nil, WithFilter(func(_ Model, msg Msg) Msg { return msg }))47 if p.filter == nil {48 t.Errorf("expected filter to be set")
61 unmodified lines
modified:options.go+8 added
68 unmodified lines
69 p.startupOptions |= withoutCatchPanics70 }71}7273// WithoutSignals will ignore OS signals.74// This is mainly useful for testing.75func WithoutSignals() ProgramOption {76 return func(p *Program) {77 p.ignoreSignals = true78 }79}8081// WithAltScreen starts the program with the alternate screen buffer enabled82// (i.e. the program starts in full window mode). Note that the altscreen will83// be automatically exited when the program quits.84//
116 unmodified lines