mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix RUN err msg (again)
Previous fix used %q which incorrectly go-escaped things. For example: ``` RUN echoo A \& B C ``` would result in the user seeing: ``` INFO[0000] The command '/bin/sh -c echoo A \\& B\tC' returned a non-zero code: 127 ``` Note the double-\ and the \t instead of a tab character The testcase had to double escape things due to logrus getting in the way but I'm going to fix that in another PR because its a change to the UX. Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
7699cee247
commit
006c066b6c
2 changed files with 3 additions and 3 deletions
|
@ -623,7 +623,7 @@ func (b *Builder) run(c *daemon.Container) error {
|
|||
// Wait for it to finish
|
||||
if ret, _ := c.WaitStop(-1 * time.Second); ret != 0 {
|
||||
return &jsonmessage.JSONError{
|
||||
Message: fmt.Sprintf("The command %q returned a non-zero code: %d", b.Config.Cmd.ToString(), ret),
|
||||
Message: fmt.Sprintf("The command '%s' returned a non-zero code: %d", b.Config.Cmd.ToString(), ret),
|
||||
Code: ret,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5416,12 +5416,12 @@ func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) {
|
|||
name := "testbuildbadrunerrmsg"
|
||||
_, out, err := buildImageWithOut(name, `
|
||||
FROM busybox
|
||||
RUN badEXE a1 a2`, false)
|
||||
RUN badEXE a1 \& a2 a3`, false) // tab between a2 and a3
|
||||
if err == nil {
|
||||
c.Fatal("Should have failed to build")
|
||||
}
|
||||
|
||||
exp := `The command \"/bin/sh -c badEXE a1 a2\" returned a non-zero code: 127"`
|
||||
exp := "The command '/bin/sh -c badEXE a1 \\\\& a2\\ta3' returned a non-zero code: 127"
|
||||
if !strings.Contains(out, exp) {
|
||||
c.Fatalf("RUN doesn't have the correct output:\nGot:%s\nExpected:%s", out, exp)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue