Exemple #1
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse("timelimit")

	var err error
	state.timelimit, err = time.ParseDuration(state.cmd.Me.Args[0])
	if err != nil {
		cmd.ArgError(err)
	}
	if state.timelimit < 0 {
		cmd.BadArgs("timelimit must be non-negative")
	}
}
Exemple #2
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse("period")

	var err error
	state.period, err = time.ParseDuration(state.cmd.Me.Args[0])
	if err != nil {
		cmd.ArgError(err)
	}
	if state.period < 0 {
		cmd.BadArgs("period must be non-negative")
	}

	tmp := os.TempDir()
	key := cmd.MakeKey(state.cmd.Cmd.Name, state.cmd.Cmd.Args)
	state.statname = filepath.Join(tmp, fmt.Sprintf("%s_%s", state.cmd.Me.Name, key))
}
Exemple #3
0
func init() {
	log.SetFlags(0)
	state.cmd = cmd.Parse("maxfail")

	maxfail, err := strconv.ParseInt(state.cmd.Me.Args[0], 0, 0)
	if err != nil {
		cmd.ArgError(err)
	}
	if maxfail < 1 {
		cmd.BadArgs("maxfail must be positive")
	}
	state.maxfail = int(maxfail)

	tmp := os.TempDir()
	key := cmd.MakeKey(state.cmd.Cmd.Name, state.cmd.Cmd.Args)
	state.logname = filepath.Join(tmp, fmt.Sprintf("%s_%s.log", state.cmd.Me.Name, key))
}