How do I capture the output of @code_llvm in a variable?

I want to capture it so I can open it in a pager:

function more(content::AbstractString)
    run(pipeline(`echo $(content)`, `less`))
    nothing
end
more(@code_llvm sth())

This might help:

1 Like

Use the function instead https://docs.julialang.org/en/v1/stdlib/InteractiveUtils/#InteractiveUtils.code_llvm. In particular, the io argument.

Also, it’s not a good idea to use echo. You should just use an IOBuffer instead.

5 Likes