Cleanup test file

This commit is contained in:
tidwall 2021-03-30 07:41:08 -07:00
parent 99f437a123
commit 730a465d73
1 changed files with 16 additions and 0 deletions

View File

@ -924,6 +924,22 @@ func (rd *Reader) readCommands(leftover *int) ([]Command, error) {
return rd.readCommands(leftover) return rd.readCommands(leftover)
} }
// ReadCommands reads the next pipeline commands.
func (rd *Reader) ReadCommands() ([]Command, error) {
for {
if len(rd.cmds) > 0 {
cmds := rd.cmds
rd.cmds = nil
return cmds, nil
}
cmds, err := rd.readCommands(nil)
if err != nil {
return []Command{}, err
}
rd.cmds = cmds
}
}
// ReadCommand reads the next command. // ReadCommand reads the next command.
func (rd *Reader) ReadCommand() (Command, error) { func (rd *Reader) ReadCommand() (Command, error) {
if len(rd.cmds) > 0 { if len(rd.cmds) > 0 {