MCPcopy Create free account
hub / github.com/ccusage/ccusage / stop

Method stop

rust/crates/ccusage/src/progress.rs:207–238  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

205 }
206
207 pub(crate) fn stop(&mut self) {
208 if !self.enabled || self.stopped {
209 return;
210 }
211 self.stopped = true;
212 if !self.owns_session {
213 return;
214 }
215 if let Some(running) = self.running.take() {
216 let (lock, cvar) = &*running;
217 if let Ok(mut is_running) = lock.lock() {
218 *is_running = false;
219 cvar.notify_all();
220 }
221 }
222 if let Some(worker) = self.worker.take() {
223 let _ = worker.join();
224 }
225 if let Some(controller) = self.controller.as_ref()
226 && let Ok(mut state) = controller.state.lock()
227 {
228 if state.rendered {
229 let _ = write!(io::stderr(), "\r\x1b[K\x1b[?25h");
230 let _ = io::stderr().flush();
231 }
232 state.status = None;
233 state.states.clear();
234 }
235 ACTIVE_PROGRESS.with(|active| {
236 *active.borrow_mut() = None;
237 });
238 }
239
240 pub(crate) fn set_status(&mut self, status: Option<String>) {
241 let Some(controller) = self.controller.as_ref() else {

Callers 3

dropMethod · 0.80
track_usage_loadFunction · 0.80
track_statusFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected