Skip to content

Commit

Permalink
Use the aformentioned utility in code
Browse files Browse the repository at this point in the history
  • Loading branch information
lynzrand committed Oct 29, 2024
1 parent f3203e6 commit bcd7215
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions crates/moonbuild/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// For inquiries, you can contact us via e-mail at [email protected].

use indexmap::IndexMap;
use moonutil::iters::ItersExtension;
use moonutil::module::ModuleDB;
use moonutil::package::Package;
use moonutil::path::PathComponent;
Expand Down Expand Up @@ -150,7 +151,7 @@ pub fn n2_run_interface(
let catcher = Arc::clone(&logger);
let output_json = moonbuild_opt.output_json;
let render_and_catch = move |output: &str| {
output.split('\n').for_each(|content| {
output.split('\n').strip_two_sides("").for_each(|content| {
catcher.lock().unwrap().push(content.to_owned());
if output_json {
println!("{content}");
Expand Down Expand Up @@ -199,13 +200,16 @@ pub fn n2_run_interface(
let raw_json = std::fs::read_to_string(&output_path)
.context(format!("failed to open `{}`", output_path.display()))?;

raw_json.split('\n').for_each(|content| {
if output_json {
println!("{content}");
} else {
moonutil::render::MooncDiagnostic::render(content, use_fancy);
}
});
raw_json
.split('\n')
.strip_two_sides("")
.for_each(|content| {
if output_json {
println!("{content}");
} else {
moonutil::render::MooncDiagnostic::render(content, use_fancy);
}
});
} else {
let mut output_file = std::fs::File::create(output_path)?;

Expand Down

0 comments on commit bcd7215

Please sign in to comment.