diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-06-16 23:49:48 +0530 |
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-06-17 20:49:19 +0530 |
| commit | 2e4f2d2f3bb566a36339bf28b2167b6c68823b5b (patch) | |
| tree | 8f281216f88c6fa9b3a527d1e6e60e5e96c5f540 | |
| parent | 16bc870ee2c05ed56a003c3f0444a067afc54c18 (diff) | |
| download | rust-2e4f2d2f3bb566a36339bf28b2167b6c68823b5b.tar.gz rust-2e4f2d2f3bb566a36339bf28b2167b6c68823b5b.zip | |
move from start process to new start and wait for output api's
| -rw-r--r-- | src/bootstrap/src/utils/channel.rs | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/bootstrap/src/utils/channel.rs b/src/bootstrap/src/utils/channel.rs index 38f250af42f..a7ccdbf6eab 100644 --- a/src/bootstrap/src/utils/channel.rs +++ b/src/bootstrap/src/utils/channel.rs @@ -11,7 +11,7 @@ use std::path::Path; use super::execution_context::ExecutionContext; use super::helpers; use crate::Build; -use crate::utils::helpers::{start_process, t}; +use crate::utils::helpers::t; #[derive(Clone, Default)] pub enum GitInfo { @@ -46,7 +46,7 @@ impl GitInfo { let mut git_command = helpers::git(Some(dir)); git_command.arg("rev-parse"); - let output = git_command.allow_failure().run_capture(exec_ctx); + let output = git_command.allow_failure().run_capture(&exec_ctx); if output.is_failure() { return GitInfo::Absent; @@ -59,23 +59,28 @@ impl GitInfo { } // Ok, let's scrape some info - let ver_date = start_process( - helpers::git(Some(dir)) - .arg("log") - .arg("-1") - .arg("--date=short") - .arg("--pretty=format:%cd") - .as_command_mut(), - ); - let ver_hash = - start_process(helpers::git(Some(dir)).arg("rev-parse").arg("HEAD").as_command_mut()); - let short_ver_hash = start_process( - helpers::git(Some(dir)).arg("rev-parse").arg("--short=9").arg("HEAD").as_command_mut(), - ); + let mut git_log_cmd = helpers::git(Some(dir)); + let ver_date = git_log_cmd + .arg("log") + .arg("-1") + .arg("--date=short") + .arg("--pretty=format:%cd") + .start_capture_stdout(&exec_ctx); + + let mut git_hash_cmd = helpers::git(Some(dir)); + let ver_hash = git_hash_cmd.arg("rev-parse").arg("HEAD").start_capture_stdout(&exec_ctx); + + let mut git_short_hash_cmd = helpers::git(Some(dir)); + let short_ver_hash = git_short_hash_cmd + .arg("rev-parse") + .arg("--short=9") + .arg("HEAD") + .start_capture_stdout(&exec_ctx); + GitInfo::Present(Some(Info { - commit_date: ver_date().trim().to_string(), - sha: ver_hash().trim().to_string(), - short_sha: short_ver_hash().trim().to_string(), + commit_date: ver_date.wait_for_output().stdout().trim().to_string(), + sha: ver_hash.wait_for_output().stdout().trim().to_string(), + short_sha: short_ver_hash.wait_for_output().stdout().trim().to_string(), })) } |
