# How do I capture the output of @code\_llvm in a variable?

**URL:** https://discourse.julialang.org/t/how-do-i-capture-the-output-of-code-llvm-in-a-variable/37994
**Category:** General Usage
**Tags:** performance, macros, llvm
**Created:** [April 21, 2020, 10:16pm UTC](https://discourse.julialang.org/t/how-do-i-capture-the-output-of-code-llvm-in-a-variable/37994 "2020-04-21T22:16:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NightMachinary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nightmachinary/32/14196_2.png) [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)
#### Post date: [April 21, 2020, 10:16pm UTC](https://discourse.julialang.org/t/how-do-i-capture-the-output-of-code-llvm-in-a-variable/37994/1 "2020-04-21T22:16:54Z")

</div>

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

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

```

---

<div class="post-metadata">

### Author: ![AndiMD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andimd/32/6531_2.png) [@AndiMD](https://discourse.julialang.org/u/AndiMD)
#### Post date: [April 21, 2020, 10:36pm UTC](https://discourse.julialang.org/t/how-do-i-capture-the-output-of-code-llvm-in-a-variable/37994/2 "2020-04-21T22:36:01Z")

</div>

This might help:

> **[GitHub - JuliaIO/Suppressor.jl: Julia macros for suppressing and/or capturing...](https://github.com/JuliaIO/Suppressor.jl)**
>
> Julia macros for suppressing and/or capturing output (STDOUT), warnings (STDERR) or both streams at the same time. - GitHub - JuliaIO/Suppressor.jl: Julia macros for suppressing and/or capturing ou...

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [April 21, 2020, 11:55pm UTC](https://discourse.julialang.org/t/how-do-i-capture-the-output-of-code-llvm-in-a-variable/37994/3 "2020-04-21T23:55:12Z")

</div>

Use the function instead [Interactive Utilities · The Julia Language](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.
