# Different behavior of repl & julia for run() or rather pipeline()

**URL:** <https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 27, 2018, 12:04pm UTC](https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684 "2018-07-27T12:04:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oniter](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@oniter](https://discourse.julialang.org/u/oniter)\
**Post date:** [July 27, 2018, 12:04pm UTC](https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684/1 "2018-07-27T12:04:12Z")

</div>

Why is the result different & **is this the correct behavior**?

The following command

> readstring(pipeline(`ps -eo command`,`grep blablabla`,`wc -l`))

where **blablabla** is a name for a process which doesn’t exist at the moment,  
when run in REPL gives always the correct result

> “1\n”

what is the grep cmd itself.

But execute a script which have the exact same command inside throws always the error

> ERROR: LoadError: failed process: Process(`grep blablabla`, ProcessExited(1)) [1]  
> Stacktrace:  
> [1] pipeline\_error(::Base.Process) at ./process.jl:682  
> [2] pipeline\_error(::Base.ProcessChain) at ./process.jl:695  
> [3] read(::Base.OrCmds, ::Base.DevNullStream) at ./process.jl:629  
> [4] readstring at ./process.jl:634 [inlined] (repeats 2 times)  
> [5] include\_from\_node1(::String) at ./loading.jl:576  
> [6] include(::String) at ./sysimg.jl:14  
> [7] process\_options(::Base.JLOptions) at ./client.jl:305  
> [8] \_start() at ./client.jl:371  
> while loading /path/testjulia.jl, in expression starting on line 1

what is different and maybe not correct? Or what I’m doing wrong?

Used julia version 0.6.2

Thx for reading and any hints!

---

<div class="post-metadata">

**Author:** ![oniter](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@oniter](https://discourse.julialang.org/u/oniter)\
**Post date:** [August 5, 2018, 4:33am UTC](https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684/2 "2018-08-05T04:33:54Z")

</div>

Huuhuu, tock tock ![:wink:](https://emoji.discourse-cdn.com/twitter/wink.png?v=5)

No hints nor explanations?

Can someone confirm that behavior?  
Should I open a bug in github?  
Or is this an user fault?

Thx for reading & answering.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [August 5, 2018, 8:13am UTC](https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684/3 "2018-08-05T08:13:36Z")

</div>

On version 0.7, it appears to work how you want it to.

```julia
julia-0.7> read(pipeline(`ps -eo command`,`grep blablabla`,`wc -l`), String)
" 1\n"

shell> cat /tmp/temp.jl
read(pipeline(`ps -eo command`,`grep blablabla`,`wc -l`), String)

julia-0.7> include("/tmp/temp.jl")
" 1\n"

```

---

<div class="post-metadata">

**Author:** ![oniter](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@oniter](https://discourse.julialang.org/u/oniter)\
**Post date:** [August 5, 2018, 9:16am UTC](https://discourse.julialang.org/t/different-behavior-of-repl-julia-for-run-or-rather-pipeline/12684/4 "2018-08-05T09:16:31Z")

</div>

Thx for testing. I saw that readstring is now [deprecated](https://docs.julialang.org/en/latest/NEWS/#Deprecated-or-removed-1).

Wunderful that it is working properly under 0.7

THX a lot and SOLVED!
