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!
julia
to create the file in the background, and then immediately try to move it. This is a race condition. You need to find a way to wait for it. Ways include running onejulia
instance for each so that you can wait for the process to exit, have the program log something to stdout.txt that you can periodically check for, guess that it'll take less than 60 seconds and sleep for that long, or havetest.jl
itself move the file when it's done. – that other guyfind
piped intoxargs rm
, it couldn't go on and find a second file until the first one were completely finished being deleted. You'd need to come up with a completely new set of flow-control constructs to communicate when such processing is complete -- and what value would you get in return? – Charles Duffy