# Update stdout while a function is running

**URL:** <https://discourse.julialang.org/t/update-stdout-while-a-function-is-running/86285>\
**Category:** General Usage\
**Tags:** parallel\
**Created:** [August 24, 2022, 6:38pm UTC](https://discourse.julialang.org/t/update-stdout-while-a-function-is-running/86285 "2022-08-24T18:38:39Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Ashlin\_Harris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashlin_harris/32/210166_2.png) [@Ashlin\_Harris](https://discourse.julialang.org/u/Ashlin_Harris)\
**Post date:** [January 26, 2023, 10:21pm UTC](https://discourse.julialang.org/t/update-stdout-while-a-function-is-running/86285/9 "2023-01-26T22:21:00Z")

</div>

I finally hacked together something that updates a spinner while calculations are done and closes the process (by sending a character to its `stdin`):

```julia
command = "t=Threads.@async read(stdin, Char);while !istaskdone(t);for q=['\\\\','|','/','-'];print(q);sleep(0.1);print('\b')end;end;exit()"
proc_input = Pipe()
proc = run(pipeline(`julia -e $command`, stdin = proc_input, stdout = stdout, stderr = stderr), wait = false)
sum(map(i->BigInt(999)^10_000_000 % i, 1:10)); # Do some calculations
write(proc_input,'c') #Signal the spinner process to stop

```

---

_[View the full topic](https://discourse.julialang.org/t/update-stdout-while-a-function-is-running/86285)._
