Browse Source

fix flush

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Victor Vieux 11 năm trước cách đây
mục cha
commit
90e9a2d85a
2 tập tin đã thay đổi với 13 bổ sung1 xóa
  1. 12 0
      engine/streams.go
  2. 1 1
      server.go

+ 12 - 0
engine/streams.go

@@ -109,6 +109,18 @@ func (o *Output) Write(p []byte) (n int, err error) {
 	return len(p), firstErr
 }
 
+func (o *Output) Flush() {
+	o.Mutex.Lock()
+	defer o.Mutex.Unlock()
+	for _, dst := range o.dests {
+		if f, ok := dst.(interface {
+			Flush()
+		}); ok {
+			f.Flush()
+		}
+	}
+}
+
 // Close unregisters all destinations and waits for all background
 // AddTail and AddString tasks to complete.
 // The Close method of each destination is called if it exists.

+ 1 - 1
server.go

@@ -1324,7 +1324,7 @@ func (srv *Server) ImagePull(job *engine.Job) engine.Status {
 		tag         string
 		sf          = utils.NewStreamFormatter(job.GetenvBool("json"))
 		out         = utils.NewWriteFlusher(job.Stdout)
-		authConfig  *auth.AuthConfig
+		authConfig  = &auth.AuthConfig{}
 		metaHeaders map[string][]string
 	)
 	if len(job.Args) > 1 {