Skip to content

Commit

Permalink
fix progress line overwrite moonc diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Dec 26, 2024
1 parent e0734e6 commit 0e5b6a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "n2"
version = "0.1.4"
version = "0.1.5"
categories = ["development-tools", "development-tools::build-utils"]
edition = "2018"
exclude = [".github/*", ".vscode/*"]
Expand Down
5 changes: 5 additions & 0 deletions src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ impl FancyState {
fn task_finished(&mut self, id: BuildId, build: &Build, result: &TaskResult) {
self.tasks
.remove(self.tasks.iter().position(|t| t.id == id).unwrap());

self.clear_progress();

match result.termination {
Termination::Success => {
// Common case: don't show anything.
Expand All @@ -298,6 +301,8 @@ impl FancyState {
std::io::stdout().write_all(&result.output).unwrap();
}
}

// mark as dirty to trigger progress update
self.dirty();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/regen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ fn restat() -> anyhow::Result<()> {
let out = space.run_expect(&mut n2_command(vec!["build.ninja"]))?;
assert_output_not_contains(&out, "touch build.ninja");

// But modifying the input should cause it to be up to date.
std::thread::sleep(std::time::Duration::from_millis(100));

space.write("in", "")?;
let out = space.run_expect(&mut n2_command(vec!["build.ninja"]))?;
assert_output_contains(&out, "touch build.ninja");
Expand Down

0 comments on commit 0e5b6a6

Please sign in to comment.