kontena / k8s-client

Ruby Kubernetes API client
Apache License 2.0
76 stars 26 forks source link

`watch` as in the example, lines printed on shutdown instead of as events happen #168

Closed vitobotta closed 4 years ago

vitobotta commented 4 years ago

Hi! I am trying to write a stupid simple controller that needs to watch for when Velero backups start and complete and send a slack notification. I am using the example in the readme, but the lines with the event details are printed altogether when I shutdown the script, instead of being printed as the events happen. Any idea of why? Thanks!

vitobotta commented 4 years ago

So it looks like the watching is working but I have to add STDOUT.flush after puts otherwise it doesn't show anything until I shutdown the script. Why is that? :)

jakolehm commented 4 years ago

So it looks like the watching is working but I have to add STDOUT.flush after puts otherwise it doesn't show anything until I shutdown the script. Why is that? :)

You are probably missing $stdout.sync = true.

vitobotta commented 4 years ago

Yeah that works too. Closing this one.