Allow server to start on tcp port or if windows, named pipe rather than unix socket. could not yet make it work on named pipe from js client (connects but error)

This commit is contained in:
guillaume.tardif 2020-05-16 16:39:08 +02:00 committed by Guillaume Tardif
parent 23d2eacf84
commit ecfffc6feb
6 changed files with 55 additions and 5 deletions

View file

@ -2,7 +2,6 @@ package cmd
import (
"context"
"net"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@ -39,10 +38,12 @@ func ServeCommand() *cobra.Command {
func runServe(ctx context.Context, opts serveOpts) error {
s := server.New()
listener, err := net.Listen("unix", opts.address)
listener, err := server.CreateListener(opts.address)
if err != nil {
return errors.Wrap(err, "listen unix socket")
return errors.Wrap(err, "listen address "+opts.address)
}
// nolint errcheck
defer listener.Close()