MethodError while running a command

julia> out_io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> err_io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)

julia> command = Cmd(["ls"])
`ls`

julia> pipe = pipeline(command, stdout = out_io, stderr = err_io)
pipeline(pipeline(`ls`, stdout=IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)), stderr=IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1))

julia> process = run(pipe, wait=false)
ERROR: MethodError: no method matching rawhandle(::Base.GenericIOBuffer{Array{UInt8,1}})
Closest candidates are:
  rawhandle(::RawFD) at process.jl:149
  rawhandle(::Base.DevNull) at process.jl:148
  rawhandle(::Base.Filesystem.File) at filesystem.jl:69
  ...
Stacktrace:
 [1] _jl_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}},Base.GenericIOBuffer{Array{UInt8,1}}}) at ./process.jl:345
 [2] (::getfield(Base, Symbol("##493#494")){Cmd})(::Tuple{Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}},Base.GenericIOBuffer{Array{UInt8,1}}}) at ./process.jl:509
 [3] setup_stdio(::getfield(Base, Symbol("##493#494")){Cmd}, ::Tuple{Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}},Base.GenericIOBuffer{Array{UInt8,1}}}) at ./process.jl:490
 [4] #_spawn#492(::Nothing, ::Function, ::Cmd, ::Tuple{Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}},Base.GenericIOBuffer{Array{UInt8,1}}}) at ./process.jl:508
 [5] (::getfield(Base, Symbol("#kw##_spawn")))(::NamedTuple{(:chain,),Tuple{Nothing}}, ::typeof(Base._spawn), ::Cmd, ::Tuple{Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}},Base.GenericIOBuffer{Array{UInt8,1}}}) at ./none:0
 [6] #_spawn#489(::Nothing, ::Function, ::Base.CmdRedirect, ::Tuple{Base.DevNull,Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}}}) at ./process.jl:398
 [7] (::getfield(Base, Symbol("#kw##_spawn")))(::NamedTuple{(:chain,),Tuple{Nothing}}, ::typeof(Base._spawn), ::Base.CmdRedirect, ::Tuple{Base.DevNull,Base.DevNull,Base.GenericIOBuffer{Array{UInt8,1}}}) at ./none:0
 [8] #_spawn#489(::Nothing, ::Function, ::Base.CmdRedirect, ::Tuple{Base.DevNull,Base.DevNull,Base.DevNull}) at ./process.jl:398
 [9] _spawn at ./process.jl:398 [inlined]
 [10] #run#503(::Bool, ::Function, ::Base.CmdRedirect) at ./process.jl:665
 [11] (::getfield(Base, Symbol("#kw##run")))(::NamedTuple{(:wait,),Tuple{Bool}}, ::typeof(run), ::Base.CmdRedirect) at ./none:0
 [12] top-level scope at none:0
julia> versioninfo()
Julia Version 1.0.3
Commit 099e826241 (2018-12-18 01:34 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)

How to capture stdout and stderr in <1.1? perhaps?

1 Like