| ... | ... |
@@ -682,7 +682,7 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
| 682 | 682 |
} |
| 683 | 683 |
|
| 684 | 684 |
func (cli *DockerCli) CmdTop(args ...string) error {
|
| 685 |
- cmd := Subcmd("top", "CONTAINER", "Lookup the running processes of a container")
|
|
| 685 |
+ cmd := Subcmd("top", "CONTAINER [ps OPTIONS]", "Lookup the running processes of a container")
|
|
| 686 | 686 |
if err := cmd.Parse(args); err != nil {
|
| 687 | 687 |
return nil |
| 688 | 688 |
} |
| ... | ... |
@@ -350,7 +350,11 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) {
|
| 350 | 350 |
} |
| 351 | 351 |
// no scanner.Text because we skip container id |
| 352 | 352 |
for scanner.Scan() {
|
| 353 |
- words = append(words, scanner.Text()) |
|
| 353 |
+ if i != 0 && len(words) == len(procs.Titles) {
|
|
| 354 |
+ words[len(words)-1] = fmt.Sprintf("%s %s", words[len(words)-1], scanner.Text())
|
|
| 355 |
+ } else {
|
|
| 356 |
+ words = append(words, scanner.Text()) |
|
| 357 |
+ } |
|
| 354 | 358 |
} |
| 355 | 359 |
if i == 0 {
|
| 356 | 360 |
procs.Titles = words |