summaryrefslogtreecommitdiffstats
path: root/hugolib/site.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-07-05 10:13:41 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-07-05 10:23:29 +0200
commite31b1d194655ac3a38fe903ff3995806b129b88a (patch)
tree8ffac9e39952c9f547b7b4e92620c1c05c84bfc5 /hugolib/site.go
parent43a23239b2e3ad602c06d9af0b648e0304fc8744 (diff)
commands: Make the --poll flag a duration
So you can do: ``` hugo server --poll 700ms ``` See #8720
Diffstat (limited to 'hugolib/site.go')
-rw-r--r--hugolib/site.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 2e23368d7..2e7e1d7f9 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -29,6 +29,8 @@ import (
"strings"
"time"
+ "github.com/gohugoio/hugo/common/types"
+
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/common/constants"
@@ -523,13 +525,9 @@ But this also means that your site configuration may not do what you expect. If
timeout := 30 * time.Second
if cfg.Language.IsSet("timeout") {
v := cfg.Language.Get("timeout")
- if n := cast.ToInt(v); n > 0 {
- timeout = time.Duration(n) * time.Millisecond
- } else {
- d, err := time.ParseDuration(cast.ToString(v))
- if err == nil {
- timeout = d
- }
+ d, err := types.ToDurationE(v)
+ if err == nil {
+ timeout = d
}
}