autoschematic-core 0.14.2

Core shared functionality for Autoschematic: workflow engine, state management, and Git integrations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// use nix::fcntl::{Flock, FlockArg};
// use tokio::task::spawn_blocking;

// pub fn hold_flock_blocking(path: &Path) -> anyhow::Result<Flock<File>> {
//     let file = OpenOptions::new().create(true).truncate(true).write(true).open(path)?;

//     let lock = match Flock::lock(file, FlockArg::LockExclusive) {
//         Ok(l) => l,
//         Err((_, e)) => return Err(e.into()),
//     };

//     Ok(lock)
// }

// pub async fn wait_for_flock(path: PathBuf) -> anyhow::Result<Flock<File>> {
//     spawn_blocking(move || -> Result<Flock<File>, anyhow::Error> { hold_flock_blocking(&path) }).await?
// }