File tree 3 files changed +4
-15
lines changed
crates/tmc-langs-util/src
3 files changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,8 @@ impl LockOptions {
41
41
let mut opts = OpenOptions :: new ( ) ;
42
42
match self {
43
43
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 ) ,
45
46
// truncate requires write
46
47
Self :: ReadTruncate => opts. write ( true ) . truncate ( true ) ,
47
48
Self :: Write => opts. write ( true ) ,
Original file line number Diff line number Diff line change @@ -11,19 +11,6 @@ use std::{
11
11
path:: { Path , PathBuf } ,
12
12
} ;
13
13
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
-
27
14
/// Blocks until the lock can be acquired.
28
15
#[ derive( Debug ) ]
29
16
pub struct Lock {
Original file line number Diff line number Diff line change @@ -246,10 +246,11 @@ mod test {
246
246
let temp = tempfile:: tempdir ( ) . unwrap ( ) ;
247
247
let mut lock = Lock :: dir ( temp. path ( ) . to_path_buf ( ) , LockOptions :: Read ) . unwrap ( ) ;
248
248
let lock_path = temp. path ( ) . join ( ".tmc.lock" ) ;
249
- assert ! ( ! lock_path. exists( ) ) ;
249
+ assert ! ( lock_path. exists( ) ) ;
250
250
let guard = lock. lock ( ) . unwrap ( ) ;
251
251
assert ! ( lock_path. exists( ) ) ;
252
252
drop ( guard) ;
253
+ drop ( lock) ;
253
254
assert ! ( !lock_path. exists( ) ) ;
254
255
}
255
256
}
You can’t perform that action at this time.
0 commit comments