Skip to content

Commit

Permalink
Fix "foo: no such file or directory" test failure, and normalize crea…
Browse files Browse the repository at this point in the history
…tion of custom error to always depend on if os.IsNotExist(err) so we don't hide other errors that might crop up in these tests

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
  • Loading branch information
tianon committed Jan 14, 2014
1 parent fb63cfa commit 7a6255e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions buildfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ func (b *buildFile) CmdVolume(args string) error {
func (b *buildFile) checkPathForAddition(orig string) error {
origPath := path.Join(b.contextPath, orig)
if p, err := filepath.EvalSymlinks(origPath); err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("%s: no such file or directory", orig)
}
return err
} else {
origPath = p
Expand All @@ -297,7 +300,10 @@ func (b *buildFile) checkPathForAddition(orig string) error {
}
_, err := os.Stat(origPath)
if err != nil {
return fmt.Errorf("%s: no such file or directory", orig)
if os.IsNotExist(err) {
return fmt.Errorf("%s: no such file or directory", orig)
}
return err
}
return nil
}
Expand All @@ -313,7 +319,10 @@ func (b *buildFile) addContext(container *Container, orig, dest string) error {
}
fi, err := os.Stat(origPath)
if err != nil {
return fmt.Errorf("%s: no such file or directory", orig)
if os.IsNotExist(err) {
return fmt.Errorf("%s: no such file or directory", orig)
}
return err
}
if fi.IsDir() {
if err := archive.CopyWithTar(origPath, destPath); err != nil {
Expand Down

0 comments on commit 7a6255e

Please sign in to comment.