playr-app 0.8.0

What playr's Rust frontends share: actions, : commands, key bindings, settings and dispatch
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! One playr at a time.

use playr_app::instance::{claim_at, ALREADY_RUNNING};

#[test]
fn a_second_claim_is_refused_until_the_first_ends() {
    let dir = tempfile::tempdir().unwrap();
    let path = dir.path().join("playr/instance.lock");
    let first = claim_at(&path).unwrap();
    assert_eq!(claim_at(&path).unwrap_err(), ALREADY_RUNNING);
    drop(first);
    assert!(claim_at(&path).is_ok(), "the lock outlived its holder");
}