Error gracefully when an image is not found on pull. Addresses #50 and comments from #49

This commit is contained in:
Charles Hooper
2013-03-12 05:49:57 +00:00
parent b8219b5275
commit 8e0986caec
2 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -89,7 +89,7 @@ func Pv(src io.Reader, info io.Writer) io.Reader {
// the body of the response. If `stderr` is not nil, a progress bar will be
// written to it.
func Curl(url string, stderr io.Writer) (io.Reader, error) {
curl := exec.Command("curl", "-#", "-L", url)
curl := exec.Command("curl", "-#", "-L", "--fail", url)
output, err := curl.StdoutPipe()
if err != nil {
return nil, err
@@ -98,5 +98,8 @@ func Curl(url string, stderr io.Writer) (io.Reader, error) {
if err := curl.Start(); err != nil {
return nil, err
}
if err := curl.Wait(); err != nil {
return nil, err
}
return output, nil
}