This crate contains support for creating lock files as are used on
various UNIX type systems. This is similar to the lockfile
program
from procmail or the dotlockfile
program
from liblockfile.
Add this to your Cargo.toml
:
[dependencies]
dotlock = "0"
...and this to your crate root:
extern crate dotlock;
extern crate dotlock;
use std::fs::File;
use std::io::{Write, Read, Seek, SeekFrom};
fn main() {
let mut lock = dotlock::Dotlock::create("some.file.lock").unwrap();
writeln!(lock, "Do not touch this file!").unwrap();
}