File tree Expand file tree Collapse file tree 3 files changed +4
-15
lines changed
crates/tmc-langs-util/src Expand file tree Collapse file tree 3 files changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ impl LockOptions {
4141 let mut opts = OpenOptions :: new ( ) ;
4242 match self {
4343 Self :: Read => opts. read ( true ) ,
44- Self :: ReadCreate => opts. read ( true ) . create ( true ) ,
44+ // create requires write
45+ Self :: ReadCreate => opts. read ( true ) . write ( true ) . create ( true ) ,
4546 // truncate requires write
4647 Self :: ReadTruncate => opts. write ( true ) . truncate ( true ) ,
4748 Self :: Write => opts. write ( true ) ,
Original file line number Diff line number Diff line change @@ -11,19 +11,6 @@ use std::{
1111 path:: { Path , PathBuf } ,
1212} ;
1313
14- /// Blocks until the lock can be acquired.
15- #[ derive( Debug ) ]
16- pub struct LockA {
17- pub path : PathBuf ,
18- }
19-
20- impl LockA {
21- pub fn new ( path : impl AsRef < Path > ) -> Self {
22- let path = path. as_ref ( ) . to_path_buf ( ) ;
23- Self { path }
24- }
25- }
26-
2714/// Blocks until the lock can be acquired.
2815#[ derive( Debug ) ]
2916pub struct Lock {
Original file line number Diff line number Diff line change @@ -246,10 +246,11 @@ mod test {
246246 let temp = tempfile:: tempdir ( ) . unwrap ( ) ;
247247 let mut lock = Lock :: dir ( temp. path ( ) . to_path_buf ( ) , LockOptions :: Read ) . unwrap ( ) ;
248248 let lock_path = temp. path ( ) . join ( ".tmc.lock" ) ;
249- assert ! ( ! lock_path. exists( ) ) ;
249+ assert ! ( lock_path. exists( ) ) ;
250250 let guard = lock. lock ( ) . unwrap ( ) ;
251251 assert ! ( lock_path. exists( ) ) ;
252252 drop ( guard) ;
253+ drop ( lock) ;
253254 assert ! ( !lock_path. exists( ) ) ;
254255 }
255256}
You can’t perform that action at this time.
0 commit comments