зеркало из https://github.com/microsoft/docker.git
Re-enabled CmdPull progress bar code which had been temporarily disabled
This commit is contained in:
Родитель
2192d3371c
Коммит
5675439b91
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/dotcloud/docker/image"
|
||||
"github.com/dotcloud/docker/rcli"
|
||||
"io"
|
||||
// "net/http"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -393,20 +393,20 @@ func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string
|
|||
fmt.Fprintf(stdout, "Downloading from %s\n", u.String())
|
||||
// Download with curl (pretty progress bar)
|
||||
// If curl is not available, fallback to http.Get()
|
||||
// archive, err := future.Curl(u.String(), stdout)
|
||||
// if err != nil {
|
||||
// if resp, err := http.Get(u.String()); err != nil {
|
||||
// return err
|
||||
// } else {
|
||||
// archive = resp.Body
|
||||
// }
|
||||
// }
|
||||
// fmt.Fprintf(stdout, "Unpacking to %s\n", name)
|
||||
// img, err := srv.images.Import(name, archive, nil)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// fmt.Fprintln(stdout, img.Id)
|
||||
archive, err := future.Curl(u.String(), stdout)
|
||||
if err != nil {
|
||||
if resp, err := http.Get(u.String()); err != nil {
|
||||
return err
|
||||
} else {
|
||||
archive = resp.Body
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(stdout, "Unpacking to %s\n", name)
|
||||
img, err := srv.images.Import(name, archive, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintln(stdout, img.Id)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче