MCPcopy
hub / github.com/charmbracelet/bubbletea / execBatchMsg

Method execBatchMsg

tea.go:918–958  ·  view source on GitHub ↗
(msg BatchMsg)

Source from the content-addressed store, hash-verified

916}
917
918func (p *Program) execBatchMsg(msg BatchMsg) {
919 if !p.disableCatchPanics {
920 defer func() {
921 if r := recover(); r != nil {
922 p.recoverFromGoPanic(r)
923 }
924 }()
925 }
926
927 // Execute commands one at a time.
928 var wg sync.WaitGroup
929 for _, cmd := range msg {
930 if cmd == nil {
931 continue
932 }
933 wg.Add(1)
934 go func() {
935 defer wg.Done()
936
937 if !p.disableCatchPanics {
938 defer func() {
939 if r := recover(); r != nil {
940 p.recoverFromGoPanic(r)
941 }
942 }()
943 }
944
945 msg := cmd()
946 switch msg := msg.(type) {
947 case BatchMsg:
948 p.execBatchMsg(msg)
949 case sequenceMsg:
950 p.execSequenceMsg(msg)
951 default:
952 p.Send(msg)
953 }
954 }()
955 }
956
957 wg.Wait() // wait for all commands from batch msg to finish
958}
959
960// shouldQuerySynchronizedOutput determines whether the terminal should be
961// queried for various capabilities.

Callers 2

eventLoopMethod · 0.95
execSequenceMsgMethod · 0.95

Calls 4

recoverFromGoPanicMethod · 0.95
execSequenceMsgMethod · 0.95
SendMethod · 0.95
WaitMethod · 0.80

Tested by

no test coverage detected