-
Notifications
You must be signed in to change notification settings - Fork 424
go get on windows failed #15
Comments
I think it's a fair request to have grace not fail on windows, even if it doesn't actually support graceful restart. I think this mode is a useful compromise for developers using windows but yet deploying to posix environments. I don't have a windows environment setup to work on this but happy to accept pull requests :) |
any chance this will be fixed? I have a windows development machine and i inherited a project that's dependent on this particular library so i can't do anything with it unless i dabble with the source of grace, but that's dirty as hell... |
We're not currently working on windows support, but I'd be more than happy to review a pull request :) |
I'll see what i can do tomorrow :) I have 2 options: Now I have a third, i'll look through the source more closely tomorrow and get back to you :) |
What I would recommend, as the quickest fix, is to only add support for https://godoc.org/github.com/facebookgo/grace/gracehttp, which involves only 1 function, |
@kristijan-ujevic here is as a demonstration of the approach @daaku has described above. There are two files:
// +build windows
package grace
import "net/http"
func Serve(s *http.Server) error {
// The code will be a bit more complex when you add support
// of Serve(s ...*http.Server).
return s.ListenAndServe()
}
// +build !windows
package grace
import (
"net/http"
"github.com/facebookgo/grace/gracehttp"
)
func Serve(s *http.Server) error {
return gracehttp.Serve(s)
} That's it. Now the |
i'm not really sure what i need to do with this? i'm somewhat new to Go, can you explain a bit further please? :) |
@kristijan-ujevic Read more about Build Constraints, that is the key here. You create 2 files with 2 different log.Fatal(Serve(&http.Server{
Addr: "...",
Handler: ...,
})) The package I've linked is just an illustration of this approach. You don't want to depend on it for such a simple use-case, but if you do here is a working code that will support graceful restarts and shutdowns on *nix based platforms and just work on windows: package main
import (
"log"
"github.com/colegion/contrib/servers/grace"
)
func main() {
s := &http.Server{...}
log.Fatal(grace.Serve(s))
} |
Same issue |
Anybody tell me what is this github |
I have no idea about this |
What i can do here yell me now |
go get github.com/facebookgo/grace/gracedemo github.com/facebookgo/grace/gracehttp..\github.com\facebookgo\grace\gracehttp\http.go:104:53: undefined: syscall.SIGUSR2 |
SIGUSR2 is not define on windows ,just clone , set GOOS=linux ,go build |
same issue ,how could i restart the server in windows |
Running a
go get github.com/facebookgo/grace/gracehttp
gives me:The text was updated successfully, but these errors were encountered: