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

If logging to STDOUT in CLI set $stdout.sync = true #882

Merged
merged 2 commits into from
Mar 8, 2023
Merged

If logging to STDOUT in CLI set $stdout.sync = true #882

merged 2 commits into from
Mar 8, 2023

Conversation

blafri
Copy link
Contributor

@blafri blafri commented Mar 6, 2023

When running the CLI from non-interactive terminals such as foreman or docker, the logs were not being displayed immediatly because ruby sets $stdout.sync = false for these types of terminals by default which causes the log messages to be buffered. This leads to inconsistent behaviour between interactive and non-interactive terminals for the CLI application. By explicitly setting $stdout.sync = true when launching the CLI application we can ensure that STDOUT logging is consistent in both types of terminals.

See #879 and #490 for further disscussion.

When running the CLI from non-interactive terminals such as foreman or
docker, the logs were not being displayed immediatly because ruby sets
$stdout.sync = false for these types of terminals by default. This leads
to inconsistent behaviour between interactive and non-interactive
terminals for the CLI application. By explicitly setting $stdout.sync =
true when launching the CLI application we can ensure that STDOUT
logging is consistent in both types of terminals.
@bensheldon bensheldon changed the title If logging to STDOUT set $stdout.sync = true If logging to STDOUT in CLI set $stdout.sync = true Mar 8, 2023
Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blafri Thank you this is great! 🎉

I will merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants