Skip to content

Commit 2e4f2d2

Browse files
committed
move from start process to new start and wait for output api's
1 parent 16bc870 commit 2e4f2d2

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

src/bootstrap/src/utils/channel.rs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::Path;
1111
use super::execution_context::ExecutionContext;
1212
use super::helpers;
1313
use crate::Build;
14-
use crate::utils::helpers::{start_process, t};
14+
use crate::utils::helpers::t;
1515

1616
#[derive(Clone, Default)]
1717
pub enum GitInfo {
@@ -46,7 +46,7 @@ impl GitInfo {
4646

4747
let mut git_command = helpers::git(Some(dir));
4848
git_command.arg("rev-parse");
49-
let output = git_command.allow_failure().run_capture(exec_ctx);
49+
let output = git_command.allow_failure().run_capture(&exec_ctx);
5050

5151
if output.is_failure() {
5252
return GitInfo::Absent;
@@ -59,23 +59,28 @@ impl GitInfo {
5959
}
6060

6161
// Ok, let's scrape some info
62-
let ver_date = start_process(
63-
helpers::git(Some(dir))
64-
.arg("log")
65-
.arg("-1")
66-
.arg("--date=short")
67-
.arg("--pretty=format:%cd")
68-
.as_command_mut(),
69-
);
70-
let ver_hash =
71-
start_process(helpers::git(Some(dir)).arg("rev-parse").arg("HEAD").as_command_mut());
72-
let short_ver_hash = start_process(
73-
helpers::git(Some(dir)).arg("rev-parse").arg("--short=9").arg("HEAD").as_command_mut(),
74-
);
62+
let mut git_log_cmd = helpers::git(Some(dir));
63+
let ver_date = git_log_cmd
64+
.arg("log")
65+
.arg("-1")
66+
.arg("--date=short")
67+
.arg("--pretty=format:%cd")
68+
.start_capture_stdout(&exec_ctx);
69+
70+
let mut git_hash_cmd = helpers::git(Some(dir));
71+
let ver_hash = git_hash_cmd.arg("rev-parse").arg("HEAD").start_capture_stdout(&exec_ctx);
72+
73+
let mut git_short_hash_cmd = helpers::git(Some(dir));
74+
let short_ver_hash = git_short_hash_cmd
75+
.arg("rev-parse")
76+
.arg("--short=9")
77+
.arg("HEAD")
78+
.start_capture_stdout(&exec_ctx);
79+
7580
GitInfo::Present(Some(Info {
76-
commit_date: ver_date().trim().to_string(),
77-
sha: ver_hash().trim().to_string(),
78-
short_sha: short_ver_hash().trim().to_string(),
81+
commit_date: ver_date.wait_for_output().stdout().trim().to_string(),
82+
sha: ver_hash.wait_for_output().stdout().trim().to_string(),
83+
short_sha: short_ver_hash.wait_for_output().stdout().trim().to_string(),
7984
}))
8085
}
8186

0 commit comments

Comments
 (0)