Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker images since 0.28.0 does not write to STDOUT #7875

Closed
Xosmond opened this issue Jun 9, 2019 · 6 comments
Closed

Docker images since 0.28.0 does not write to STDOUT #7875

Xosmond opened this issue Jun 9, 2019 · 6 comments
Labels
community:to-research help wanted This issue is generally accepted and needs someone to pick it up status:needs-more-info

Comments

@Xosmond
Copy link

Xosmond commented Jun 9, 2019

Hi. I have this issue, since crystal 0.28.0 container image I can't get any STDOUT to work properly. In image 0.27.2 it works fine. But on 0.28.0 and now 0.29.0 it doesn't work.

I'm using:

  • Docker (18.09.2) (Docker desktop community 2.0.0.3 (31259))
  • MacOs Mojave 10.14.5.
@wooster0
Copy link
Contributor

Might be related to #7470.

@j8r
Copy link
Contributor

j8r commented Jun 10, 2019

Try either to:

  • Set STDOUT.sync = true
  • Or use STDOUT.puts, which flush after printing.
  • Or use STDOUT.flush after STDOUT <<

@Xosmond
Copy link
Author

Xosmond commented Jun 15, 2019

Hello, using STDOUT.sync = true worked fine thanks. I'm not sure if we should start having differences when running on a machine or on a container.

@jhass
Copy link
Member

jhass commented Aug 7, 2019

It would be good if somebody could provide an isolated example showcasing the issue. Otherwise I would vote to close this since I think we have related issues with better descriptions :)

@jhass jhass added help wanted This issue is generally accepted and needs someone to pick it up community:to-research status:needs-more-info labels Aug 7, 2019
@greenbigfrog
Copy link

I haven't yet been able to exactly isolate the issue, but I've been trying to pinpoint.

FROM crystallang/crystal:0.30.0
ADD . /src
WORKDIR /src
RUN crystal build --release -s src/some_code.cr
ENTRYPOINT /src/some_code

Having a simple puts "some text here" in some_code.cr will work.

If I now make it a simple website using kemal and it's builtin logging, no output at all:

require "kemal"

get "/" do
  "Hello World!"
end

puts "Some Text"

Kemal.run

If I then add the STDOUT.sync = true as suggested above it'll output like it should:

require "kemal"

STDOUT.sync = true

get "/" do
  "Hello World!"
end

puts "Some Text"

Kemal.run

(For my own project having a custom logger, that initialized a ::Logger.new STDOUT somehow also worked, but I haven't been able to reproduce it with this "example")

I know this technically isn't really an isolated example, but maybe this will help.

@Xosmond
Copy link
Author

Xosmond commented Sep 15, 2020

I think we can close this, since last versions are working fine.

@Xosmond Xosmond closed this as completed Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community:to-research help wanted This issue is generally accepted and needs someone to pick it up status:needs-more-info
Projects
None yet
Development

No branches or pull requests

5 participants