Skip to content

Commit

Permalink
fix: explicitly stop progress bars when exiting (#3272)
Browse files Browse the repository at this point in the history
Fixes #3267
  • Loading branch information
jdx authored Nov 28, 2024
1 parent 1cfa6dc commit 8c0b694
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
26 changes: 17 additions & 9 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -942,16 +942,24 @@
"description": "config file for mise version manager (mise.toml)",
"properties": {
"alias": {
"description": "custom shorthands",
"type": "object",
"additionalProperties": {
"additionalProperties": {
"description": "version alias points to",
"type": "string"
},
"description": "plugin to set aliases for",
"type": "object"
},
"description": "custom shorthands for versions",
"type": "object"
"oneOf": [
{
"description": "where the alias goes",
"type": "string"
},
{
"description": "tool to set aliases for",
"type": "object",
"additionalProperties": {
"description": "version alias points to",
"type": "string"
}
}
]
}
},
"env": {
"oneOf": [
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ mod versions_host;

pub(crate) use crate::exit::exit;
pub(crate) use crate::toolset::install_state;
use crate::ui::multi_progress_report::MultiProgressReport;

fn main() -> eyre::Result<()> {
color_eyre::install()?;
Expand All @@ -79,6 +80,9 @@ fn main() -> eyre::Result<()> {
Err(err) => handle_err(err),
}?;
});
if let Some(mpr) = MultiProgressReport::try_get() {
mpr.stop()?;
}
Ok(())
}

Expand Down
6 changes: 6 additions & 0 deletions src/ui/multi_progress_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ impl MultiProgressReport {
None => f(),
}
}
pub fn stop(&self) -> eyre::Result<()> {
if let Some(mp) = &self.mp {
mp.clear()?;
}
Ok(())
}
}

#[cfg(test)]
Expand Down

0 comments on commit 8c0b694

Please sign in to comment.