@@ -11,7 +11,7 @@ use std::path::Path;
11
11
use super :: execution_context:: ExecutionContext ;
12
12
use super :: helpers;
13
13
use crate :: Build ;
14
- use crate :: utils:: helpers:: { start_process , t } ;
14
+ use crate :: utils:: helpers:: t ;
15
15
16
16
#[ derive( Clone , Default ) ]
17
17
pub enum GitInfo {
@@ -46,7 +46,7 @@ impl GitInfo {
46
46
47
47
let mut git_command = helpers:: git ( Some ( dir) ) ;
48
48
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) ;
50
50
51
51
if output. is_failure ( ) {
52
52
return GitInfo :: Absent ;
@@ -59,23 +59,28 @@ impl GitInfo {
59
59
}
60
60
61
61
// 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
+
75
80
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 ( ) ,
79
84
} ) )
80
85
}
81
86
0 commit comments