From f55fa8211b6faf08091dd99ed8e5e3f08ab9cf1f Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 20 Jun 2014 12:22:31 -0400 Subject: [PATCH] Escape control and nonprintable characters in docker ps The docker ps command displays the user-entered command running in a container. If that command contained \n, \t, or other control characters, they were interpreted literally, and newlines and tabs would be printed in the output. Escape the command string to make things more readable. Docker-DCO-1.1-Signed-off-by: Matt Heon (github: mheon) --- api/client/commands.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/client/commands.go b/api/client/commands.go index 0cdf3f1acb..8f76b6e26a 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -1476,6 +1476,7 @@ func (cli *DockerCli) CmdPs(args ...string) error { outCommand = out.Get("Command") ports = engine.NewTable("", 0) ) + outCommand = strconv.Quote(outCommand) if !*noTrunc { outCommand = utils.Trunc(outCommand, 20) }