<commit_before>package testrunner

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"time"

	"code.cloudfoundry.org/rep/cmd/rep/config"

	"github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

type Runner struct {
	binPath           string
	Session           *gexec.Session
	StartCheck        string
	repConfig         config.RepConfig
	repConfigFilePath string
}
type Duration time.Duration

func New(binPath string, repConfig config.RepConfig) *Runner {
	return &Runner{
		binPath:    binPath,
		StartCheck: "rep.started",
		repConfig:  repConfig,
	}
}

func (d *Duration) MarshalJSON() ([]byte, error) {
	t := time.Duration(*d)
	return []byte(fmt.Sprintf(`"%s"`, t.String())), nil
}

func (r *Runner) Start() {
	if r.Session != nil && r.Session.ExitCode() == -1 {
		panic("starting more than one rep!!!")
	}

	f, err := ioutil.TempFile("", "rep")
	Expect(err).NotTo(HaveOccurred())

	encoder := json.NewEncoder(f)

	err = encoder.Encode(r.repConfig)
	Expect(err).NotTo(HaveOccurred())

	r.repConfigFilePath = f.Name()

	args := []string{
		"--config", r.repConfigFilePath,
	}
<commit_msg>Delete unused type Duration<commit_after>package testrunner

import (
	"encoding/json"
	"io/ioutil"
	"os"
	"os/exec"
	"time"

	"code.cloudfoundry.org/rep/cmd/rep/config"

	"github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
)

type Runner struct {
	binPath           string
	Session           *gexec.Session
	StartCheck        string
	repConfig         config.RepConfig
	repConfigFilePath string
}

func New(binPath string, repConfig config.RepConfig) *Runner {
	return &Runner{
		binPath:    binPath,
		StartCheck: "rep.started",
		repConfig:  repConfig,
	}
}

func (r *Runner) Start() {
	if r.Session != nil && r.Session.ExitCode() == -1 {
		panic("starting more than one rep!!!")
	}

	f, err := ioutil.TempFile("", "rep")
	Expect(err).NotTo(HaveOccurred())

	encoder := json.NewEncoder(f)

	err = encoder.Encode(r.repConfig)
	Expect(err).NotTo(HaveOccurred())

	r.repConfigFilePath = f.Name()

	args := []string{
		"--config", r.repConfigFilePath,
	}

{'fraction_non_alphanumeric': 0.15693430656934307, 'fraction_numerical': 0.0009124087591240876, 'mean_word_length': 3.656050955414013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4910659', 'n_tokens_mistral': 859, 'n_tokens_neox': 823, 'n_words': 159}