()
| 23 | ) |
| 24 | |
| 25 | func main() { |
| 26 | ctx, cancel := context.WithCancel(context.Background()) |
| 27 | |
| 28 | sigs := make(chan os.Signal, 1) |
| 29 | signal.Notify(sigs, syscall.SIGTERM, syscall.SIGINT) |
| 30 | go func() { |
| 31 | s := <-sigs |
| 32 | cancel() |
| 33 | println(printPrefix, "Received", s) |
| 34 | println(printPrefix, "Exiting") |
| 35 | }() |
| 36 | |
| 37 | res, err := extensionClient.Register(ctx, extensionName) |
| 38 | if err != nil { |
| 39 | panic(err) |
| 40 | } |
| 41 | println(printPrefix, "Register response:", prettyPrint(res)) |
| 42 | |
| 43 | port := os.Getenv("EXTENSION_HTTP_PORT") |
| 44 | if len(port) == 0 { |
| 45 | port = "2772" |
| 46 | } |
| 47 | |
| 48 | ipc.Start(port) |
| 49 | |
| 50 | // Will block until shutdown event is received or cancelled via the context. |
| 51 | processEvents(ctx) |
| 52 | } |
| 53 | |
| 54 | func processEvents(ctx context.Context) { |
| 55 | for { |
nothing calls this directly
no test coverage detected