projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0ce6f05
)
Fix panic with HTTP serve initialization problems.
author
Vincent Batoufflet
<vincent@batoufflet.info>
Sun, 26 Jan 2014 09:48:00 +0000
(10:48 +0100)
committer
spf13
<steve.francia@gmail.com>
Wed, 29 Jan 2014 04:44:43 +0000
(23:44 -0500)
commands/server.go
patch
|
blob
|
history
diff --git
a/commands/server.go
b/commands/server.go
index cb33aedff043ad00ac5b8d3eec8cd27a8623f557..5ae518eef82131ca714a62ce6f4f4c9f0826f823 100644
(file)
--- a/
commands/server.go
+++ b/
commands/server.go
@@
-17,6
+17,7
@@
import (
"fmt"
"github.com/spf13/cobra"
"net/http"
+ "os"
"strconv"
"strings"
)
@@
-83,5
+84,10
@@
func serve(port int) {
}
fmt.Println("Press ctrl+c to stop")
- panic(http.ListenAndServe(":"+strconv.Itoa(port), http.FileServer(http.Dir(Config.GetAbsPath(Config.PublishDir)))))
+
+ err := http.ListenAndServe(":"+strconv.Itoa(port), http.FileServer(http.Dir(Config.GetAbsPath(Config.PublishDir))))
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error())
+ os.Exit(1)
+ }
}