If I enter
t1 = @async begin; sleep(5); println("done1"); end
at the julia REPL, I get
Task (runnable, started) @0x00007f575a6c3d00
julia> done1
If I compile and run
function main()
t1 = @async begin; sleep(5); println("done1"); end
end
main()
I get no error messages and output
startup from ~/.julia/config.startup.jl
Why can’t I get the same output as the REPL?
Because your program exits before the async task finishes. You need to wait
for it to finish.