mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
using cmd.CombinedOutput()
This commit is contained in:
parent
4ca2bb2101
commit
1c2221b2c5
@ -1,7 +1,6 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
@ -67,11 +66,8 @@ func run(goos, goarch string, command []string) error {
|
||||
cmd := exec.Command(command[0], command[1:]...)
|
||||
cmd.Env = append(cmd.Env, os.Environ()...)
|
||||
cmd.Env = append(cmd.Env, "GOOS="+goos, "GOARCH="+goarch)
|
||||
var stdout bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
return errors.New(stdout.String())
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
return errors.New(string(out))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fpm
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"log"
|
||||
"os/exec"
|
||||
@ -82,11 +81,8 @@ func create(ctx *context.Context, format, archive, arch string) error {
|
||||
options = append(options, name+"="+filepath.Join("/usr/local/bin", name))
|
||||
cmd := exec.Command("fpm", options...)
|
||||
|
||||
var stdout bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
return errors.New(stdout.String())
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
return errors.New(string(out))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user