| 123 | |
| 124 | impl Drop for Spinner { |
| 125 | fn drop(&mut self) { |
| 126 | // If the spinner wasn't explicitly finished (e.g. `?` propagated an |
| 127 | // error), still stop the thread, clear the line, and restore the |
| 128 | // cursor so the terminal is left in a sane state. |
| 129 | self.stop(); |
| 130 | if self.interactive { |
| 131 | let mut stderr = std::io::stderr(); |
| 132 | let _ = write!(stderr, "\r\x1b[2K\x1b[?25h"); |
| 133 | let _ = stderr.flush(); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /// Stack size for the thread driving the async entrypoint. Windows gives the |