(msg BatchMsg)
| 916 | } |
| 917 | |
| 918 | func (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. |
no test coverage detected