summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chomp.go3
-rw-r--r--shell.go4
-rw-r--r--wget.go8
3 files changed, 13 insertions, 2 deletions
diff --git a/chomp.go b/chomp.go
index da4fe9e..7af9e3b 100644
--- a/chomp.go
+++ b/chomp.go
@@ -71,6 +71,9 @@ func Chomp(a interface{}) string {
log.Printf("shell.Chomp() FOUND *bytes.Buffer")
var tmp *bytes.Buffer
tmp = a.(*bytes.Buffer)
+ if (tmp == nil) {
+ return ""
+ }
var bytesSplice []byte
bytesSplice = tmp.Bytes()
diff --git a/shell.go b/shell.go
index d4bdb74..0617db0 100644
--- a/shell.go
+++ b/shell.go
@@ -44,8 +44,8 @@ func InitCallback(f func(interface{}, int)) {
}
// this means it won't copy all the output to STDOUT
-func Quiet() {
- quiet = true
+func Quiet(q bool) {
+ quiet = q
}
func Script(cmds string) int {
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
}