# Can't capture the output of print() in a worker process

**URL:** <https://discourse.julialang.org/t/cant-capture-the-output-of-print-in-a-worker-process/34335>\
**Category:** General Usage\
**Created:** [February 8, 2020, 1:14am UTC](https://discourse.julialang.org/t/cant-capture-the-output-of-print-in-a-worker-process/34335 "2020-02-08T01:14:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alyosha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alyosha/32/9889_2.png) [@Alyosha](https://discourse.julialang.org/u/Alyosha)\
**Post date:** [February 8, 2020, 1:14am UTC](https://discourse.julialang.org/t/cant-capture-the-output-of-print-in-a-worker-process/34335/1 "2020-02-08T01:14:47Z")

</div>

Why is it that when I `print()` something in a worker process that doesn’t end with a newline char `\n`, I don’t capture it in the `stdout` of the master process, but if I use `println()` I do?

For example consider the following MWE:

```julia
using Distributed

addprocs(1)

@everywhere function hello()
   print("hi!")
end

@spawnat 2 hello();

```

and I see nothing. But if I use `print("hi!\n")` or use `println()`, I see the message printed.

---

<div class="post-metadata">

**Author:** ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Post date:** [February 9, 2020, 12:59pm UTC](https://discourse.julialang.org/t/cant-capture-the-output-of-print-in-a-worker-process/34335/2 "2020-02-09T12:59:45Z")

</div>

Some systems does not print in the output standard (yes in the error standard) until the new line is indicated (by buffer reason). After the print add a println, and you should see it.

---

<div class="post-metadata">

**Author:** ![Alyosha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alyosha/32/9889_2.png) [@Alyosha](https://discourse.julialang.org/u/Alyosha)\
**Post date:** [February 11, 2020, 10:44pm UTC](https://discourse.julialang.org/t/cant-capture-the-output-of-print-in-a-worker-process/34335/3 "2020-02-11T22:44:32Z")

</div>

Thanks. I also suspected it may be related to buffering. But even if I add `flush(stdout)` after the print, still nothing shows up. Maybe there is another buffer related to the piping of the worker’s stdout to the master’s?
