summaryrefslogtreecommitdiff
path: root/wget.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-07 01:15:37 -0700
committerJeff Carr <[email protected]>2019-06-07 01:15:37 -0700
commit2fcc7947db28b2d48e4fcf71a129f615d1e702b5 (patch)
tree77b06c4509eddf47e0e1a641164df14edc45c51d /wget.go
parentb56c3fe1f6ecd91c771c8a80cca779f1dc6ace8a (diff)
add a quiet flag and some other fixes
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'wget.go')
-rw-r--r--wget.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/wget.go b/wget.go
index c0f66cc..04e82d3 100644
--- a/wget.go
+++ b/wget.go
@@ -12,6 +12,8 @@ package shell
import "io"
import "os"
+import "fmt"
+import "log"
import "bytes"
import "strings"
import "net/http"
@@ -32,6 +34,12 @@ func Wget(url string) (*bytes.Buffer) {
}
defer resp.Body.Close()
+ log.Printf("res.StatusCode: %d\n", resp.StatusCode)
+ if (resp.StatusCode == 404) {
+ handleError(fmt.Errorf("404"), -1)
+ return nil
+ }
+
buf.ReadFrom(resp.Body)
return buf
}