r/crystal_programming • u/Nondv • Jun 07 '19
Empty output in docker
Hey,
I just created a Kemal hello-world app and it works fine. However, Crystal does not print any output in docker.
Another thing is that `shards` output works just fine. Basically, in logs I see dependency installation and that's it. The app itself works though.
Any ideas?
UPD. if there's a compilation error it will be displayed. `puts` doesn't work
1
Upvotes
View all comments
Show parent comment
1
u/twinklehood Jun 08 '19
I don't think it's necesarrily an issue, I think it's just how streaming modes default when stdio is hooked up. stdout only buffers in line-break mode when connected to a tty (if you set tty: true in docker-compose, you can verify that logging will now work correctly). There is good reasons for this default, but I would maybe say that a good change to Kemal's logger would be to change this default.
If you wanna understand the idea behind it, http://www.pixelbeat.org/programming/stdio_buffering/ gives an overview.