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

run with stdin=IOBuffer(str) doesn't work with str a substring #36406

Closed
c42f opened this issue Jun 24, 2020 · 2 comments
Closed

run with stdin=IOBuffer(str) doesn't work with str a substring #36406

c42f opened this issue Jun 24, 2020 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior io Involving the I/O subsystem: libuv, read, write, etc.

Comments

@c42f
Copy link
Member

c42f commented Jun 24, 2020

The following pipeline works as expected:

julia> run(pipeline(`cat`, stdin=IOBuffer("Hello world\n")))
Hello world
Process(`cat`, ProcessExited(0))

But if the IOBuffer contains a substring (eg, from split) a method error occurs:

julia> run(pipeline(`cat`, stdin=IOBuffer(SubString("Hello world\n"))))
ERROR: MethodError: no method matching rawhandle(::Base.GenericIOBuffer{SubArray{UInt8,1,Array{UInt8,1},Tuple{UnitRange{Int64}},true}})
Closest candidates are:
  rawhandle(::RawFD) at cmd.jl:161
  rawhandle(::Base.DevNull) at cmd.jl:160
  rawhandle(::Base.Filesystem.File) at filesystem.jl:75
@c42f c42f added io Involving the I/O subsystem: libuv, read, write, etc. bug Indicates an unexpected problem or unintended behavior labels Jun 24, 2020
@laborg
Copy link
Contributor

laborg commented Feb 2, 2022

This works on master now.

julia> versioninfo()
Julia Version 1.8.0-DEV.1440
<snip>

julia> run(pipeline(`cat`, stdin=IOBuffer(SubString("Hello world\n"))))
Hello world
Process(`cat`, ProcessExited(0))

@fredrikekre
Copy link
Member

Fixed and tested in #40780

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

No branches or pull requests

3 participants