mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1563 from dotcloud/1073_add_loading_message
* Runtime: Add loading containers message in no debug
This commit is contained in:
commit
8dd3607bd1
1 changed files with 11 additions and 1 deletions
12
runtime.go
12
runtime.go
|
@ -207,19 +207,29 @@ func (runtime *Runtime) Destroy(container *Container) error {
|
|||
}
|
||||
|
||||
func (runtime *Runtime) restore() error {
|
||||
wheel := "-\\|/"
|
||||
if os.Getenv("DEBUG") == "" {
|
||||
fmt.Printf("Loading containers: ")
|
||||
}
|
||||
dir, err := ioutil.ReadDir(runtime.repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, v := range dir {
|
||||
for i, v := range dir {
|
||||
id := v.Name()
|
||||
container, err := runtime.Load(id)
|
||||
if i%21 == 0 && os.Getenv("DEBUG") == "" {
|
||||
fmt.Printf("\b%c", wheel[i%4])
|
||||
}
|
||||
if err != nil {
|
||||
utils.Debugf("Failed to load container %v: %v", id, err)
|
||||
continue
|
||||
}
|
||||
utils.Debugf("Loaded container %v", container.ID)
|
||||
}
|
||||
if os.Getenv("DEBUG") == "" {
|
||||
fmt.Printf("\bdone.\n")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue