magefile / mage

a Make/rake-like dev tool using Go

Home Page:https://magefile.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Did stdin problem solved?

yakuter opened this issue · comments

Hello. Did stdin problem solved? How can I do this without using exec.Command

out, err := sh.OutputWith(envMap, filepath.Join(GOBIN, "gocov"), "convert", coverFile)
if err != nil {
    return fmt.Errorf("failed to convert coverage error: %v", err)
}

reportCmd := exec.Command("gocov", "report")
reportCmd.Stdin = strings.NewReader(out)
reportOutput, err := reportCmd.Output()
if err != nil {
    return fmt.Errorf("failed to run report error: %v", err)
}

println(string(reportOutput))