Skip to content

Commit 9b5251c

Browse files
committed
have an encapsulation to check for Bootstrap_profile flag
1 parent 35569ca commit 9b5251c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bootstrap/src/bin/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ use bootstrap::{
1818
#[cfg(feature = "tracing")]
1919
use tracing::instrument;
2020

21+
fn check_bootstrap_profile_flag() -> bool {
22+
env::var("BOOTSTRAP_PROFILE").is_ok_and(|v| v == "1")
23+
}
24+
2125
#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "main"))]
2226
fn main() {
2327
#[cfg(feature = "tracing")]
@@ -152,7 +156,7 @@ fn main() {
152156
}
153157
}
154158

155-
if env::var("BOOTSTRAP_PROFILE").is_ok_and(|v| v == "1") {
159+
if check_bootstrap_profile_flag() {
156160
build.report_summary(start_time);
157161
}
158162
}
@@ -234,7 +238,7 @@ fn setup_tracing() -> impl Drop {
234238
let mut chrome_layer = tracing_chrome::ChromeLayerBuilder::new().include_args(true);
235239

236240
// Writes the Chrome profile to trace-<unix-timestamp>.json if enabled
237-
if !env::var("BOOTSTRAP_PROFILE").is_ok_and(|v| v == "1") {
241+
if !check_bootstrap_profile_flag() {
238242
chrome_layer = chrome_layer.writer(io::sink());
239243
}
240244

0 commit comments

Comments
 (0)