MCPcopy Create free account
hub / github.com/charmbracelet/bubbletea / execBatchMsg

Method execBatchMsg

tea.go:985–1025  ·  view source on GitHub ↗
(msg BatchMsg)

Source from the content-addressed store, hash-verified

983}
984
985func (p *Program) execBatchMsg(msg BatchMsg) {
986 if !p.disableCatchPanics {
987 defer func() {
988 if r := recover(); r != nil {
989 p.recoverFromGoPanic(r)
990 }
991 }()
992 }
993
994 // Execute commands one at a time.
995 var wg sync.WaitGroup
996 for _, cmd := range msg {
997 if cmd == nil {
998 continue
999 }
1000 wg.Add(1)
1001 go func() {
1002 defer wg.Done()
1003
1004 if !p.disableCatchPanics {
1005 defer func() {
1006 if r := recover(); r != nil {
1007 p.recoverFromGoPanic(r)
1008 }
1009 }()
1010 }
1011
1012 msg := cmd()
1013 switch msg := msg.(type) {
1014 case BatchMsg:
1015 p.execBatchMsg(msg)
1016 case sequenceMsg:
1017 p.execSequenceMsg(msg)
1018 default:
1019 p.Send(msg)
1020 }
1021 }()
1022 }
1023
1024 wg.Wait() // wait for all commands from batch msg to finish
1025}
1026
1027// shouldQuerySynchronizedOutput determines whether the terminal should be
1028// 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