Closed AshlinHarris closed 1 year ago
function spinner()
p = 0
try
c = "while true;" *
"for i in \"\\\\|/-\";" *
"print(\"\\b\$i\");" *
"sleep(0.1);" *
"end;" *
"end"
p = run(pipeline(` julia -e $c`, stdout), wait=false)
s = 0
for i in 10:17
s += BigInt(999)^10_000_000 % 17
end
return(s)
finally
kill(p)
print("\b")
end
end
println(spinner())
The \@spinner macro should edit the command c
, display the corresponding spinner, and send a signal to stop when the actual work s
is complete.
The following functionality now exists:
@spinner result = f(); println(result)
Currently, the default spinner can't be changed by the user, but this is a planned feature.
https://discourse.julialang.org/t/update-stdout-while-a-function-is-running/86285/8