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

open for processes is different with mode strings vs. keyword args #32193

Closed
JeffBezanson opened this issue May 30, 2019 · 2 comments · Fixed by #32832
Closed

open for processes is different with mode strings vs. keyword args #32193

JeffBezanson opened this issue May 30, 2019 · 2 comments · Fixed by #32832
Assignees
Labels
domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:minor change Marginal behavior change acceptable for a minor release
Milestone

Comments

@JeffBezanson
Copy link
Sponsor Member

We allow both mode strings ("r" etc.) and keyword arguments (read=true) in open for both commands and files. Generally the mode strings correspond to equivalent keyword arguments. However they behave differently for processes:

julia> open(`ls foo`, read=true) do f
       end

julia> ls: cannot access foo: No such file or directory

julia> open(`ls foo`, "r") do f
       end
ls: cannot access foo: No such file or directory
ERROR: failed process: Process(`ls foo`, ProcessExited(2)) [2]

This is because there is a special method for opening a process with a function and mode string (which adds the ProcessFailedException), but the keyword arg form is caught by the fallback that just calls close when the function returns. I assume we want them both to give the ProcessFailedException?

@JeffBezanson JeffBezanson added the domain:io Involving the I/O subsystem: libuv, read, write, etc. label May 30, 2019
@StefanKarpinski
Copy link
Sponsor Member

Yes, that sounds better. Probably a "minor change" for the 1.3 release.

@StefanKarpinski StefanKarpinski added kind:minor change Marginal behavior change acceptable for a minor release status:triage This should be discussed on a triage call labels May 30, 2019
@StefanKarpinski
Copy link
Sponsor Member

Triage thinks this was probably just a mistake that should be fixed but it's too potentially breaking for point releases.

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. kind:minor change Marginal behavior change acceptable for a minor release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants