In the following test.jl creates an output.txt and generates some console output. console output is very well handled. but control returns immediately after echo even before output.txt is created completely. placing a wait in between echo and mv causes an indefinite wait. Should a carriage return be passed to the pipe without killing the pipe yet?
mkfifo pipe
sleep 1000000 > pipe &
julia <pipe >stdout.txt 2>stderr.txt &
echo "include(\"test.jl\")" > pipe
mv output.txt temp/
echo "include(\"test2.jl\")" > pipe
Thanks!
I understand that
test.jl
andtest2.jl
both write tooutput.txt
so you have to move the file to another directory before runningtest2.jl
ortest2.jl
expectsoutput.txt
intemp/
directory and you have to move it there beforetext2.jl
runs.If yes then the following code should solve the problem:
In this way Julia runs
mv
command and you make sure that it is executed aftertest.jl
but beforetest2.jl
.But actually we are getting to a point where it would be better to write a Julia script named e.g.
script.jl
:and run it using
julia script.jl
.