File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use std::sync::Arc;
77
88use crossbeam:: utils:: CachePadded ;
99use fail:: fail_point;
10+ use fs2:: FileExt ;
1011use log:: error;
1112use parking_lot:: { Mutex , MutexGuard , RwLock } ;
1213
@@ -464,7 +465,17 @@ impl<F: FileSystem> SinglePipe<F> {
464465pub struct DualPipes < F : FileSystem > {
465466 pipes : [ SinglePipe < F > ; 2 ] ,
466467
467- _dir_locks : Vec < StdFile > ,
468+ dir_locks : Vec < StdFile > ,
469+ }
470+
471+ impl < F : FileSystem > Drop for DualPipes < F > {
472+ fn drop ( & mut self ) {
473+ for lock in & self . dir_locks {
474+ if let Err ( e) = FileExt :: unlock ( lock) {
475+ error ! ( "error while unlocking directory: {e}" ) ;
476+ }
477+ }
478+ }
468479}
469480
470481impl < F : FileSystem > DualPipes < F > {
@@ -481,7 +492,7 @@ impl<F: FileSystem> DualPipes<F> {
481492
482493 Ok ( Self {
483494 pipes : [ appender, rewriter] ,
484- _dir_locks : dir_locks,
495+ dir_locks,
485496 } )
486497 }
487498
You can’t perform that action at this time.
0 commit comments