Runs the given function while showing a spinner animation. The spinner
is always stopped before this returns — even when fn throws — so the
terminal isn't left with a dangling timer that keeps printing.
Starts the spinner animation. No-op when stdout is not attached to a
terminal — animating into a pipe or log file would just write control
characters that pollute captured output.