# Is redirect\_stderr broken?

**URL:** <https://discourse.julialang.org/t/is-redirect-stderr-broken/2606>\
**Category:** General Usage\
**Created:** [March 11, 2017, 4:13pm UTC](https://discourse.julialang.org/t/is-redirect-stderr-broken/2606 "2017-03-11T16:13:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [March 11, 2017, 4:13pm UTC](https://discourse.julialang.org/t/is-redirect-stderr-broken/2606/1 "2017-03-11T16:13:46Z")

</div>

```julia
julia> redirect_stdout()
(Base.PipeEndpoint(RawFD(21) open, 0 bytes waiting), Base.PipeEndpoint(RawFD(22) open, 0 bytes waiting))

julia> print("asd")

julia> redirect_stderr()
(Base.PipeEndpoint(RawFD(23) open, 0 bytes waiting), Base.PipeEndpoint(RawFD(24) open, 0 bytes waiting))

julia> error("asd")
ERROR: asd
Stacktrace:
 [1] error(::String) at ./error.jl:21

```

I also get a nasty segfault on 0.6 (I might not have the latest version) when calling it on remote workers:

```julia
julia> addprocs(1)
1-element Array{Int64,1}:
 2

julia> remotecall_fetch(redirect_stderr,2)
(
signal (11): Segmentation fault: 11

```

---

<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:** [March 11, 2017, 5:03pm UTC](https://discourse.julialang.org/t/is-redirect-stderr-broken/2606/2 "2017-03-11T17:03:32Z")

</div>

`redirect_stderr` on workers might not do what you want since the stderr is redirected already. I don’t see anything wrong with the single process one. You aren’t writting to STDERR anyway.

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [March 11, 2017, 5:28pm UTC](https://discourse.julialang.org/t/is-redirect-stderr-broken/2606/3 "2017-03-11T17:28:03Z")

</div>

What’s the way to write to STDERR then ? It seems errors should go there.

I’m trying to capture both prints and errors on remote workers (for each worker independently).

---

<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:** [March 11, 2017, 6:23pm UTC](https://discourse.julialang.org/t/is-redirect-stderr-broken/2606/4 "2017-03-11T18:23:34Z")

</div>

The output you see comes from the REPL. The uncaught error printing will go to the STDERR in a script.
