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

question

#1

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!


#2

Huuhuu, tock tock :wink:

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.


#3

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

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"

#4

Thx for testing. I saw that readstring is now deprecated.

Wunderful that it is working properly under 0.7

THX a lot and SOLVED!