reapply Cmd value even if CmdAdd returns early

Docker-DCO-1.1-Signed-off-by: Maximilian Goisser <goisser94@gmail.com> (github: hobofan)
This commit is contained in:
Hobofan 2014-04-28 18:30:43 +02:00
parent 4155874443
commit 6893689336
1 changed files with 1 additions and 1 deletions

View File

@ -482,6 +482,7 @@ func (b *buildFile) CmdAdd(args string) error {
cmd := b.config.Cmd
b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", orig, dest)}
defer func(cmd []string) { b.config.Cmd = cmd }(cmd)
b.config.Image = b.image
var (
@ -617,7 +618,6 @@ func (b *buildFile) CmdAdd(args string) error {
if err := b.commit(container.ID, cmd, fmt.Sprintf("ADD %s in %s", orig, dest)); err != nil {
return err
}
b.config.Cmd = cmd
return nil
}