From b60190e6adf4b2321fdb49d2ffa7c630b731a8cf Mon Sep 17 00:00:00 2001 From: "Eric J. Holmes" Date: Thu, 31 Dec 2015 15:33:02 +0700 Subject: [PATCH] Log write errors from tugboat. --- .../src/github.com/remind101/tugboat/tugboat.go | 4 +++- server/github/deployer.go | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Godeps/_workspace/src/github.com/remind101/tugboat/tugboat.go b/Godeps/_workspace/src/github.com/remind101/tugboat/tugboat.go index fff447c4f..8d882480f 100644 --- a/Godeps/_workspace/src/github.com/remind101/tugboat/tugboat.go +++ b/Godeps/_workspace/src/github.com/remind101/tugboat/tugboat.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "io" + "log" "code.google.com/p/goauth2/oauth" "github.com/google/go-github/github" @@ -229,7 +230,8 @@ func deploy(ctx context.Context, opts DeployOpts, p Provider, t client) (deploym logsDone := make(chan struct{}, 1) go func() { // we're ignoring err here. - _ = t.WriteLogs(deployment, r) + werr := t.WriteLogs(deployment, r) + log.Printf("write logs error: %v\n", werr) close(logsDone) }() diff --git a/server/github/deployer.go b/server/github/deployer.go index da668edc3..a83e18c64 100644 --- a/server/github/deployer.go +++ b/server/github/deployer.go @@ -2,7 +2,6 @@ package github import ( "io" - "log" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/term" @@ -117,14 +116,13 @@ func (d *tugboatDeployer) Deploy(ctx context.Context, p events.Deployment, out i _, err := d.client.Deploy(ctx, opts, provider(func(ctx context.Context, _ *tugboat.Deployment, w io.Writer) error { // Write logs to both tugboat as well as the writer we were // provided (probably stdout). - combined := io.MultiWriter(w, out) + w = io.MultiWriter(w, out) - if err := d.deployer.Deploy(ctx, p, combined); err != nil { + if err := d.deployer.Deploy(ctx, p, w); err != nil { // If we got a deployment error, write the error to // tugboat and return tugboat.ErrFailed to indicate the // failure. - _, werr := io.WriteString(w, err.Error()) - log.Printf("write error: %v\n", werr) + io.WriteString(w, err.Error()) return tugboat.ErrFailed }