-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
spawn: permit using IOBuffer as stdout #52461
Conversation
2cad7d8
to
1f953d6
Compare
1f953d6
to
c516b7d
Compare
People expect to use this (the docs even almost even suggested it at some point), so it is better to make it work as expected (and better than they can emulate) than to criticize their choices. Also fix a few regressions and handling mistakes in setup_stdios: - #44500 tried to store a Redirectable into a SpawnIO, dropping FileRedirect - CmdRedirect did not allocate a ProcessChain, so it wouldd call setup_stdio then call setup_stdios on the result of that, which is strongly discouraged as setup_stdio(s) should only be called once - BufferStream was missing `check_open` calls before writing, and ignored `Base.reseteof` as a possible means of resuming writing after `closewrite` sends a shutdown message. Currently this fix is disabled because Pkg seems like a bit of a disaster with IO mismanagement. - Add `closewrite` to more methods, and document it. Fixes #39311 Fixes #49234 Closes #49233 Closes #46768
c516b7d
to
63059ae
Compare
This should avoid the test bug introduced by #52217 (this bug was noticed also in the CI run before merging #52217 (comment) but ignored there) that caused this recent CI run to fail: https://buildkite.com/julialang/julia-master/builds/31117#018c5b9f-5171-48a7-95a8-186282ca9fef |
@@ -73,6 +73,14 @@ New library features | |||
write the output to a stream rather than returning a string ([#48625]). | |||
* `sizehint!(s, n)` now supports an optional `shrink` argument to disable shrinking ([#51929]). | |||
* New function `Docs.hasdoc(module, symbol)` tells whether a name has a docstring ([#52139]). | |||
* Passing an IOBuffer as a stdout argument for Process spawn now works as | |||
expected, synchronized with `wait` or `success`, so a `Base.BufferStream` is | |||
no longer required there for correctness to avoid data-races ([#TBD]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops — "TBD" should have been updated.
People expect to use this (the docs even almost even suggested it at some point), so it is better to make it work as expected (and better than they can emulate) than to criticize their choices.
Also fix a few regressions and handling mistakes in setup_stdios:
check_open
calls before writing, and ignoredBase.reseteof
as a possible means of resuming writing afterclosewrite
sends a shutdown message. Currently this fix is disabled because Pkg seems like a bit of a disaster with IO mismanagement.closewrite
to more methods, and document it.Fixes #39311
Fixes #49234
Closes #49233
Closes #46768