Better output for Docker commands
@@ -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"
@@ -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.
