func exit(lf *logFile, perr *cmd.ProcError, rbuf *ringbuffer.B) { lf.failures++ if perr.Msg != "" { rbuf.Write([]byte(perr.Msg + "\n")) } write(lf, rbuf, lf.failures > state.maxfail) os.Exit(perr.Code) }
func write(lf *logFile, rbuf *ringbuffer.B, tostderr bool) { data := rbuf.Bytes() if err := lf.write(data); err != nil { log.Print(err) os.Exit(31) } if tostderr { _, err := os.Stderr.Write(data) if err != nil { log.Print(err) os.Exit(32) } } }