-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Thanks! This script inspired me to build a progress spinner for some scripts I'm writing.
I have found a few issues though:
- if
stop_spinneris called immediately afterstart_spinner(or some operation completes very quickly), the output gets a bit messed up. This is becausestop_spinnerdoesn't wait for the spinner job to terminate before writing to the terminal. This can be accomplished with a simplewait ${_sp_pid}. - all messages are written to stdout, where stderr is usually meant for these sorts of applications. Stdout is a buffered stream, and stderr is not, so stderr will actually work a bit better (less flickering).
- the script doesn't detect if the output (or error) stream is a terminal. It's probably undesirable to print progress information if the script output is being redirected to a file or another process. You could fix this with a simple
[[ ! -t 1 ]]check.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels