Skip to content

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

Closed

Description

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ioInvolving the I/O subsystem: libuv, read, write, etc.minor changeMarginal behavior change acceptable for a minor release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions