fixed and update fat-mount

This commit is contained in:
Moritz Gmeiner 2025-07-31 01:07:48 +02:00
commit df20ae6f0c
3 changed files with 39 additions and 4 deletions

View file

@ -5,6 +5,7 @@ edition = "2024"
[dependencies]
anyhow = "1.0.98"
ctrlc = "3.4.7"
env_logger = "0.11.8"
fat-fuse = { version = "0.1.0", path = "../fat-fuse" }
fuser = "0.15.1"

View file

@ -1,6 +1,5 @@
use std::cell::RefCell;
use std::fs::File;
use std::rc::Rc;
use std::sync::mpsc::channel;
use fat_fuse::FatFuse;
use fuser::MountOption;
@ -10,6 +9,7 @@ fn main() -> anyhow::Result<()> {
let mut args = std::env::args();
let _prog_name = args.next().unwrap();
let path = args.next().ok_or(anyhow::anyhow!("missing fs path"))?;
let mountpoint = args.next().ok_or(anyhow::anyhow!("missing mount point"))?;
@ -23,7 +23,18 @@ fn main() -> anyhow::Result<()> {
MountOption::AutoUnmount,
];
fuser::mount2(fat_fuse, mountpoint, &options).unwrap();
let (tx, rx) = channel();
ctrlc::set_handler(move || {
tx.send(()).unwrap();
})
.unwrap();
let handle = fuser::spawn_mount2(fat_fuse, mountpoint, &options)?;
rx.recv().unwrap();
println!("done");
Ok(())
}