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

pipeline errors with a IOBuffer as first argument #15479

Closed
joa-quim opened this issue Mar 13, 2016 · 10 comments
Closed

pipeline errors with a IOBuffer as first argument #15479

joa-quim opened this issue Mar 13, 2016 · 10 comments
Labels
docs This change adds or pertains to documentation

Comments

@joa-quim
Copy link

According to the docs pipeline accepts a IOBuffer as first argument, but (and see also)

julia> run(pipeline(IOBuffer("a xyz b"), `grep xyz`))
ERROR: MethodError: `uvtype` has no method matching uvtype(::Base.AbstractIOBuffer{Array{UInt8,1}})
 in _jl_spawn at process.jl:253
 in anonymous at process.jl:415
 in setup_stdio at process.jl:403
 in spawn at process.jl:414
 in spawn at process.jl:293
 in run at process.jl:530
@joa-quim joa-quim changed the title pipeline does errors with a IOFuffer as first argument pipeline does errors with a IOBuffer as first argument Mar 13, 2016
@joa-quim joa-quim changed the title pipeline does errors with a IOBuffer as first argument pipeline errors with a IOBuffer as first argument Mar 13, 2016
@vtjnash
Copy link
Member

vtjnash commented Mar 13, 2016

documentation isn't really intended to be legalistic. the operating system only understands how to use native I/O streams (like Pipe), while Julia can create many other types of I/O stream.

@vtjnash vtjnash closed this as completed Mar 13, 2016
@Keno
Copy link
Member

Keno commented Mar 13, 2016

This seems like a reasonable feature request though. The semantics seem pretty clear (write the contents of the IOBuffer as STDIN).

@Keno Keno reopened this Mar 13, 2016
@vtjnash
Copy link
Member

vtjnash commented Mar 13, 2016

we already have an API for that (writeall). but that's not the right semantics for this (IOBuffer is a File abstraction, not a Stream abstraction). then there's also the problem of defining the error handling model.

re-closing as "not a bug".

@vtjnash vtjnash closed this as completed Mar 13, 2016
@tkelman
Copy link
Contributor

tkelman commented Mar 13, 2016

According to the docs pipeline accepts a IOBuffer as first argument

We should at least clarify the docs then? Maybe not intended to be legalistic, but if people are getting confused that's a doc bug.

@joa-quim
Copy link
Author

To clarify IOBuffer says

IOBuffer() → IOBuffer
    Create an in-memory I/O stream.

but than I can't use it in pipeline. How can I use then? I mean how can I put my string in STDIN and call pipeline on it?

@vtjnash
Copy link
Member

vtjnash commented Mar 13, 2016

SO or julia-users is a better place for questions (you're looking for open(p, "w"), not IOBuffer)

@joa-quim
Copy link
Author

Sorry, it seamed appropriate to ask the question here since it's an consequence of doc contradiction. And BTW I had asked this before in julia-users. (and I still need help)

@nalimilan nalimilan added the docs This change adds or pertains to documentation label Mar 14, 2016
@nalimilan
Copy link
Member

Reopening as a doc issue. Though adding a method which would raise an error with an explanation would be even more helpful.

@nalimilan nalimilan reopened this Mar 14, 2016
@stevengj
Copy link
Member

See also #26061, where @vtjnash suggested pipeline(exename, stdin=IOBuffer(input)), and the implementation could be modeled on the code in that PR.

@KristofferC
Copy link
Member

Works now, #30278.

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

No branches or pull requests

7 participants