You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-09-16 09:26:52 +02:00
using cmd.CombinedOutput()
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package build
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@@ -67,11 +66,8 @@ func run(goos, goarch string, command []string) error {
|
|||||||
cmd := exec.Command(command[0], command[1:]...)
|
cmd := exec.Command(command[0], command[1:]...)
|
||||||
cmd.Env = append(cmd.Env, os.Environ()...)
|
cmd.Env = append(cmd.Env, os.Environ()...)
|
||||||
cmd.Env = append(cmd.Env, "GOOS="+goos, "GOARCH="+goarch)
|
cmd.Env = append(cmd.Env, "GOOS="+goos, "GOARCH="+goarch)
|
||||||
var stdout bytes.Buffer
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
cmd.Stdout = &stdout
|
return errors.New(string(out))
|
||||||
cmd.Stderr = &stdout
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
return errors.New(stdout.String())
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package fpm
|
package fpm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"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))
|
options = append(options, name+"="+filepath.Join("/usr/local/bin", name))
|
||||||
cmd := exec.Command("fpm", options...)
|
cmd := exec.Command("fpm", options...)
|
||||||
|
|
||||||
var stdout bytes.Buffer
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
cmd.Stdout = &stdout
|
return errors.New(string(out))
|
||||||
cmd.Stderr = &stdout
|
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
return errors.New(stdout.String())
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user