1use fslock_arti_fork as fslock;
2
3#[cfg(feature = "std")]
4use fslock::LockFile;
5#[cfg(feature = "std")]
6use std::{env, process};
7
8#[cfg(feature = "std")]
9fn main() -> Result<(), fslock::Error> {
10 let mut args = env::args();
11 args.next();
12
13 let path = match args.next() {
14 Some(arg) if args.next().is_none() => arg,
15 _ => {
16 eprintln!("Expected one argument");
17 process::exit(1);
18 },
19 };
20
21 let mut lockfile = LockFile::open(&path)?;
22
23 if lockfile.try_lock()? {
24 println!("SUCCESS");
25 } else {
26 println!("FAILURE");
27 }
28
29 Ok(())
30}
31
32#[cfg(not(feature = "std"))]
33fn main() {}