serve http, webdav, restic: ensure rclone exits if the port is in use

This commit is contained in:
Nick Craig-Wood 2018-11-01 17:16:31 +00:00
parent 1f05d5bf4a
commit bb5637d46a
7 changed files with 65 additions and 40 deletions

View file

@ -13,6 +13,7 @@ import (
auth "github.com/abbot/go-http-auth"
"github.com/ncw/rclone/fs"
"github.com/pkg/errors"
)
// Globals
@ -188,7 +189,7 @@ func NewServer(handler http.Handler, opt *Options) *Server {
func (s *Server) Serve() error {
ln, err := net.Listen("tcp", s.httpServer.Addr)
if err != nil {
return err
return errors.Wrapf(err, "start server failed")
}
s.listener = ln
s.waitChan = make(chan struct{})