From 0098360726e3df99e8f76dce9221a85dd89c2065 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 26 Jun 2014 02:12:18 +0000 Subject: [PATCH] abort on error and fix debug Docker-DCO-1.1-Signed-off-by: Victor Vieux (github: vieux) --- api/client/commands.go | 5 +++-- archive/archive.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/client/commands.go b/api/client/commands.go index c386e7a09c..61ef426387 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -167,8 +167,9 @@ func (cli *DockerCli) CmdBuild(args ...string) error { options := &archive.TarOptions{ Compression: archive.Uncompressed, } - ignoreFile := path.Join(root, ".dockerignore") - if ignore, err := ioutil.ReadFile(ignoreFile); err == nil { + if ignore, err := ioutil.ReadFile(path.Join(root, ".dockerignore")); err != nil && !os.IsNotExist(err) { + return fmt.Errorf("Error reading .dockerignore: '%s'", err) + } else if err == nil { for _, pattern := range strings.Split(string(ignore), "\n") { ok, err := filepath.Match(pattern, "Dockerfile") if err != nil { diff --git a/archive/archive.go b/archive/archive.go index 65a5b495eb..b9701b58af 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -343,11 +343,11 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error) for _, exclude := range options.Excludes { matched, err := filepath.Match(exclude, relFilePath) if err != nil { - utils.Errorf("Error matching: %s (pattern: %s)\n", relFilePath, exclude) + utils.Errorf("Error matching: %s (pattern: %s)", relFilePath, exclude) return err } if matched { - utils.Debugf("Skipping excluded path: %s\n", relFilePath) + utils.Debugf("Skipping excluded path: %s", relFilePath) if f.IsDir() { return filepath.SkipDir }