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

Add do-block support for redirect_std[out,err,in] #18165

Merged
merged 1 commit into from
Aug 23, 2016
Merged

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Aug 21, 2016

In particular, these simplify the process of safely testing for warnings, as exhibited in the tests:

open(filename, "w") do f
    redirect_stderr(f) do
        warn("hello")
    end
end
@test contains(readstring(filename), "WARNING: hello")

I assume this counts as a new feature and can't be backported? If so, perhaps I will add this to Compat. (If not, please add the "backport-pending" label.)

@tkelman
Copy link
Contributor

tkelman commented Aug 21, 2016

better in Compat, since it should work for 0.4 if done in Compat, but it won't be backported to 0.4 at this point

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 21, 2016

I'm not personally worried about the lack of support for it in 0.4. My question really was about 0.5.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Aug 21, 2016

Fixes #7022?

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 21, 2016

I guess for that to happen I should add stdin to the list.

Fixes #7022. In particular, these simplify testing for warnings.
@timholy timholy changed the title Add do-block support for redirect_std[out,err] Add do-block support for redirect_std[out,err,in] Aug 22, 2016
@kshyatt kshyatt added the domain:io Involving the I/O subsystem: libuv, read, write, etc. label Aug 22, 2016
@timholy timholy merged commit 7199111 into master Aug 23, 2016
@timholy timholy deleted the teh/redirect branch August 23, 2016 15:08
@stevengj
Copy link
Member

stevengj commented Jan 6, 2017

Would be nice to have capture_stdout(f::Function) and capture_stderr, to automate the process of creating a temporary file, opening it, executing code, and reading the file, then deleting it, since we have to write this code anyway in the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants