mirror of https://github.com/docker/compose.git
prevent "Tasks cannot be empty" error
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
5783b63556
commit
5080a83242
|
@ -17,10 +17,15 @@ func (c *client) ComposePs(ctx context.Context, project *compose.Project) error
|
|||
}
|
||||
w := tabwriter.NewWriter(os.Stdout, 20, 2, 3, ' ', 0)
|
||||
fmt.Fprintf(w, "Name\tState\tPorts\n")
|
||||
defer w.Flush()
|
||||
|
||||
arns, err := c.api.ListTasks(ctx, cluster, project.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(arns) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tasks, err := c.api.DescribeTasks(ctx, cluster, arns...)
|
||||
if err != nil {
|
||||
|
@ -49,7 +54,6 @@ func (c *client) ComposePs(ctx context.Context, project *compose.Project) error
|
|||
}
|
||||
fmt.Fprintf(w, "%s\t%s\t%s\n", s.Name, t.State, strings.Join(ports, ", "))
|
||||
}
|
||||
w.Flush()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue