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

Adds information to redirect_std* inline docs #49563

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

nishtha981
Copy link
Contributor

@nishtha981 nishtha981 commented Apr 29, 2023

Partially addresses issue #35959

Adds examples for redirecting std to a file to the markdown file

out_file = open("output.txt", "w")

# Redirect stdout to file
stdout = out_file
Copy link
Contributor

@Seelengrab Seelengrab Apr 29, 2023

Choose a reason for hiding this comment

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

This does not redirect stdout in code following this, that already uses the stdout variable internally. It's just rebinding the variable here. Redirecting stdout to a file is done like so:

open("output.txt", "w") do f
redirect_stdout(f) do
    # your code here
end
end

Copy link
Member

Choose a reason for hiding this comment

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

Moreover, redirect_stdout also redirects standard output from things like C libraries that don't use the Julia stdout variable.

@Seelengrab
Copy link
Contributor

The changes here only partially address #35959 - the majority of the issue, about the current documentation being confusing for people not already familiar with pipes, TTY, streams, C-stdout.. is not clarified here.

@brenhinkeller brenhinkeller added the docs This change adds or pertains to documentation label Aug 6, 2023
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Oct 30, 2023
@giordano giordano merged commit 6084a62 into JuliaLang:master Oct 31, 2023
8 checks passed
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants