@@ -88,8 +88,10 @@ impl version_control::System for Repo {
8888
8989#[ cfg( test) ]
9090mod tests {
91- use std:: { fs:: OpenOptions , io:: Write } ;
91+ use once_cell:: sync:: Lazy ;
92+ use std:: { fs:: OpenOptions , io:: Write , sync:: Mutex } ; // 1.4.0
9293
94+ static SL_GLOBAL_MUTEX : Lazy < Mutex < ( ) > > = Lazy :: new ( Mutex :: default) ;
9395 use crate :: testing;
9496
9597 use super :: * ;
@@ -103,6 +105,7 @@ mod tests {
103105
104106 impl SaplingClone {
105107 fn new ( git_repo : & testing:: GitCheckout ) -> Result < SaplingClone > {
108+ let _shared = SL_GLOBAL_MUTEX . lock ( ) . unwrap ( ) ;
106109 let temp_dir = TempDir :: new ( ) ?;
107110 assert_eq ! (
108111 std:: process:: Command :: new( "sl" )
@@ -123,6 +126,7 @@ mod tests {
123126 }
124127
125128 fn run ( & self , subcommand : & str ) -> std:: process:: Command {
129+ let _shared = SL_GLOBAL_MUTEX . lock ( ) . unwrap ( ) ;
126130 let mut cmd = std:: process:: Command :: new ( "sl" ) ;
127131 cmd. current_dir ( & self . root ) ;
128132 cmd. arg ( subcommand) ;
@@ -169,6 +173,7 @@ mod tests {
169173 }
170174
171175 fn changed_files ( & self , relative_to : Option < & str > ) -> Result < Vec < String > > {
176+ let _shared = SL_GLOBAL_MUTEX . lock ( ) . unwrap ( ) ;
172177 std:: env:: set_current_dir ( & self . root ) ?;
173178 use version_control:: System ;
174179 let repo = Repo :: new ( ) ?;
@@ -181,6 +186,7 @@ mod tests {
181186 }
182187
183188 fn merge_base_with ( & self , merge_base_with : & str ) -> Result < String > {
189+ let _shared = SL_GLOBAL_MUTEX . lock ( ) . unwrap ( ) ;
184190 std:: env:: set_current_dir ( & self . root ) ?;
185191 use version_control:: System ;
186192 let repo = Repo :: new ( ) ?;
0 commit comments