aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json2
-rw-r--r--cmd-exec.go10
2 files changed, 11 insertions, 1 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 6978301..d85db0e 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -62,7 +62,7 @@
"XDS_LOGLEVEL": "debug"
},
"args": ["exec",
- "-id", "IW7B4EE-DBY4Z74_Agent-TCF",
+ "-id", "3baf",
"-rpath", "build",
"pwd && ls .."
],
diff --git a/cmd-exec.go b/cmd-exec.go
index 1d121c3..c02496b 100644
--- a/cmd-exec.go
+++ b/cmd-exec.go
@@ -61,6 +61,7 @@ func exec(ctx *cli.Context) error {
exitChan := make(chan exitResult, 1)
IOsk.On("disconnection", func(err error) {
+ Log.Debugf("WS disconnection event with err: %v\n", err)
exitChan <- exitResult{err, 2}
})
@@ -85,6 +86,15 @@ func exec(ctx *cli.Context) error {
exitChan <- exitResult{ev.Error, ev.Code}
})
+ IOsk.On(apiv1.EVTProjectChange, func(ev apiv1.EventMsg) {
+ prj, _ := ev.DecodeProjectConfig()
+ Log.Infof("Event %v (%v): %v", ev.Type, ev.Time, prj)
+ })
+ evReg := apiv1.EventRegisterArgs{Name: apiv1.EVTProjectChange}
+ if err := HTTPCli.Post("/events/register", &evReg, nil); err != nil {
+ return cli.NewExitError(err, 1)
+ }
+
// Retrieve the project definition
prj := apiv1.ProjectConfig{}
if err := HTTPCli.Get("/projects/"+prjID, &prj); err != nil {