Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 2e560d2

Browse files
committed
print raw stdout messages via mqtt
1 parent 2973c95 commit 2e560d2

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func spawnProcess(filepath string, sketch *SketchStatus, status *Status) (int, i
483483
}
484484
if len > 0 {
485485
fmt.Println(string(temp[:len]))
486-
status.Info("/stdout", string(temp[:len]))
486+
status.Raw("/stdout", string(temp[:len]))
487487
checkForLibrariesMissingError(filepath, sketch, status, string(temp))
488488
checkSketchForMissingDisplayEnvVariable(string(temp), filepath, sketch, status)
489489
}

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func main() {
6767

6868
if *doInstall {
6969
install(s)
70+
// TODO: return after install? need to retest all the flows
7071
}
7172

7273
err = s.Run()

status.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ func (s *Status) Info(topic, msg string) {
8989
token.Wait()
9090
}
9191

92+
// Info logs a message on the specified topic
93+
func (s *Status) Raw(topic, msg string) {
94+
token := s.mqttClient.Publish("$aws/things/"+s.id+topic, 1, false, msg)
95+
token.Wait()
96+
}
97+
9298
// Publish sens on the /status topic a json representation of the connector
9399
func (s *Status) Publish() {
94100
data, err := json.Marshal(s)

0 commit comments

Comments
 (0)