Send stdout and stderr to log
Some checks failed
the build failed

This commit is contained in:
Peter Stuifzand 2019-02-25 18:40:16 +01:00
parent 47783e70ba
commit 015e93106c

View File

@ -51,6 +51,8 @@ func (fp *FilePages) Save(p string, page Page, summary, author string) error {
func saveWithGit(fp *FilePages, p string, summary, author string) error { func saveWithGit(fp *FilePages, p string, summary, author string) error {
cmd := exec.Command("git", "add", ".") cmd := exec.Command("git", "add", ".")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = fp.dirname cmd.Dir = fp.dirname
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
@ -58,6 +60,8 @@ func saveWithGit(fp *FilePages, p string, summary, author string) error {
} }
cmd = exec.Command("git", "commit", "-m", "Changes to "+p+" by "+author+"\n\n"+summary) cmd = exec.Command("git", "commit", "-m", "Changes to "+p+" by "+author+"\n\n"+summary)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = fp.dirname cmd.Dir = fp.dirname
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
@ -101,6 +105,8 @@ func DiffPrettyHtml(diffs []diffmatchpatch.Diff) string {
func (fp *FilePages) PageHistory(p string) ([]Revision, error) { func (fp *FilePages) PageHistory(p string) ([]Revision, error) {
page := strings.Replace(p, " ", "_", -1) page := strings.Replace(p, " ", "_", -1)
cmd := exec.Command("git", "log", "--pretty=oneline", "--no-decorate", "--color=never", page) cmd := exec.Command("git", "log", "--pretty=oneline", "--no-decorate", "--color=never", page)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Dir = fp.dirname cmd.Dir = fp.dirname
output, err := cmd.StdoutPipe() output, err := cmd.StdoutPipe()
if err != nil { if err != nil {
@ -151,6 +157,7 @@ func (fp *FilePages) PageHistory(p string) ([]Revision, error) {
func gitRevision(dirname, page, version string) string { func gitRevision(dirname, page, version string) string {
cmd := exec.Command("git", "show", version+":"+page) cmd := exec.Command("git", "show", version+":"+page)
cmd.Dir = dirname cmd.Dir = dirname
cmd.Stderr = os.Stderr
buf := bytes.Buffer{} buf := bytes.Buffer{}
cmd.Stdout = &buf cmd.Stdout = &buf
cmd.Start() cmd.Start()
@ -161,6 +168,7 @@ func gitRevision(dirname, page, version string) string {
func (fp *FilePages) RecentChanges() ([]Change, error) { func (fp *FilePages) RecentChanges() ([]Change, error) {
cmd := exec.Command("git", "log", "--format=--1--%nDate: %aI%n--2--", "--name-only") cmd := exec.Command("git", "log", "--format=--1--%nDate: %aI%n--2--", "--name-only")
cmd.Dir = fp.dirname cmd.Dir = fp.dirname
cmd.Stderr = os.Stderr
buf := bytes.Buffer{} buf := bytes.Buffer{}
cmd.Stdout = &buf cmd.Stdout = &buf
err := cmd.Start() err := cmd.Start()