func Expect(action *recipe.Action, outputStore *output.Store) error {
	var timeout float64
	substr, err := action.GetS(0)
	if err != nil {
		return err
	}
	if action.Has(1) {
		timeout, err = action.GetF(1)
		if err != nil {
			return err
		}
	} else {
		timeout = 5.0
	}
	start := time.Now()
	timeout = mathutil.BetweenF64(timeout, 0.01, 3600.0)
	timeoutDur := timeutil.SecondsToDuration(timeout)
	for range time.NewTicker(_DATA_READ_PERIOD).C {
		if bytes.Contains(outputStore.Bytes(), []byte(substr)) {
			outputStore.Purge()
			return nil
		}
		if time.Since(start) >= timeoutDur {
			break
		}
	}
	outputStore.Purge()
	return fmt.Errorf("Timeout (%g sec) reached", timeout)
}
////////////////////////////////////////////////////////////////////////////////// //
Expect is action processor for "expect"
package action
import (
	"bytes"
	"fmt"
	"os"
	"regexp"
	"strings"
	"time"
	"pkg.re/essentialkaos/ek.v12/mathutil"
	"pkg.re/essentialkaos/ek.v12/timeutil"
	"github.com/essentialkaos/bibop/output"
	"github.com/essentialkaos/bibop/recipe"
)
const _DATA_READ_PERIOD = 10 * time.Millisecond