Run executes a command.
(cmd string, args any, resp any)
| 302 | |
| 303 | // Run executes a command. |
| 304 | func (m *Monitor) Run(cmd string, args any, resp any) error { |
| 305 | id := m.IncreaseID() |
| 306 | |
| 307 | // Construct the command. |
| 308 | requestArgs := qmpCommand{ |
| 309 | ID: id, |
| 310 | Execute: cmd, |
| 311 | Arguments: args, |
| 312 | } |
| 313 | |
| 314 | request, err := json.Marshal(requestArgs) |
| 315 | if err != nil { |
| 316 | return err |
| 317 | } |
| 318 | |
| 319 | logCommand := !slices.Contains(ExcludedCommands, cmd) |
| 320 | return m.RunJSON(request, resp, logCommand, id) |
| 321 | } |
| 322 | |
| 323 | // RunTransaction executes a series of commands as a single transaction. |
| 324 | func (m *Monitor) RunTransaction(actions []TransactionAction) error { |