-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.go
39 lines (33 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE in the project root for license information.
*----------------------------------------------------------------*/
package main
import (
"net"
"os"
"github.com/getgauge/xml-report/logger"
gm "github.com/getgauge/gauge-proto/go/gauge_messages"
"google.golang.org/grpc"
)
const oneGB = 1024 * 1024 * 1024
func main() {
findPluginAndProjectRoot()
if os.Getenv(pluginActionEnv) == executionAction {
os.Chdir(projectRoot)
address, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0")
if err != nil {
logger.Fatal("failed to start server.")
}
l, err := net.ListenTCP("tcp", address)
if err != nil {
logger.Fatal("failed to start server.")
}
server := grpc.NewServer(grpc.MaxRecvMsgSize(oneGB))
h := &handler{server: server}
gm.RegisterReporterServer(server, h)
logger.Info("Listening on port:%d", l.Addr().(*net.TCPAddr).Port)
server.Serve(l)
}
}