Skip to content

Commit

Permalink
Better output for Docker commands (GoogleContainerTools#3607)
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot authored and Miklos Kiss committed Feb 3, 2020
1 parent 08ac155 commit 1a6ac11
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/skaffold/docker/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/term"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -220,11 +219,19 @@ func (l *localDaemon) Build(ctx context.Context, out io.Writer, workspace string
return imageID, nil
}

type descriptor interface {
Fd() uintptr
}

// streamDockerMessages streams formatted json output from the docker daemon
// TODO(@r2d4): Make this output much better, this is the bare minimum
func streamDockerMessages(dst io.Writer, src io.Reader, auxCallback func(jsonmessage.JSONMessage)) error {
fd, _ := term.GetFdInfo(dst)
return jsonmessage.DisplayJSONMessagesStream(src, dst, fd, false, auxCallback)
var termFd uintptr
f, isTerm := dst.(descriptor)
if isTerm {
termFd = f.Fd()
}

return jsonmessage.DisplayJSONMessagesStream(src, dst, termFd, isTerm, auxCallback)
}

// Push pushes an image reference to a registry. Returns the image digest.
Expand Down

0 comments on commit 1a6ac11

Please sign in to comment.