Merge pull request #2457 from dotcloud/2454_do_not_split_last_column

RemoteAPI: Do not split last column docker top
This commit is contained in:
Victor Vieux 2013-11-01 15:21:47 -07:00
commit 8f27e23b4b
3 changed files with 7 additions and 3 deletions

View File

@ -683,7 +683,7 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
}
func (cli *DockerCli) CmdTop(args ...string) error {
cmd := Subcmd("top", "CONTAINER", "Lookup the running processes of a container")
cmd := Subcmd("top", "CONTAINER [ps OPTIONS]", "Lookup the running processes of a container")
if err := cmd.Parse(args); err != nil {
return nil
}

View File

@ -729,7 +729,7 @@ The main process inside the container will receive SIGTERM, and after a grace pe
::
Usage: docker top CONTAINER
Usage: docker top CONTAINER [ps OPTIONS]
Lookup the running processes of a container

View File

@ -416,7 +416,11 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) {
}
// no scanner.Text because we skip container id
for scanner.Scan() {
words = append(words, scanner.Text())
if i != 0 && len(words) == len(procs.Titles) {
words[len(words)-1] = fmt.Sprintf("%s %s", words[len(words)-1], scanner.Text())
} else {
words = append(words, scanner.Text())
}
}
if i == 0 {
procs.Titles = words