Hello, how to exit from loop on keyboard button pressing? I see two ways: catch InterruptException or this:
function main_loop()
println("Press 'Enter' to stop.")
task = Threads.@spawn readline(stdin)
while true
if istaskdone(task)
println("stopped.")
return
end
println("working...")
sleep(1)
end
end
task = errormonitor(@async(main_loop()))
wait(task)
maybe something else?