浏览代码

Merge pull request #7315 from vieux/add_pb

add progress bar to ADD
unclejack 10 年之前
父节点
当前提交
2da75f7079
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      builder/internals.go

+ 2 - 1
builder/internals.go

@@ -151,10 +151,11 @@ func (b *Builder) runContextCommand(args []string, allowRemote bool, allowDecomp
 		defer os.RemoveAll(tmpDirName)
 
 		// Download and dump result to tmp file
-		if _, err := io.Copy(tmpFile, resp.Body); err != nil {
+		if _, err := io.Copy(tmpFile, utils.ProgressReader(resp.Body, int(resp.ContentLength), b.OutOld, b.StreamFormatter, true, "", "Downloading")); err != nil {
 			tmpFile.Close()
 			return err
 		}
+		fmt.Fprintf(b.OutStream, "\n")
 		tmpFile.Close()
 
 		// Remove the mtime of the newly created tmp file