haematite-cli 0.21.7

The haematite command: serve a store, its door and Studio, answer MCP, query with jq, and host the store's assistant seat
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Serializes pipe creation and fork while close-on-exec is set separately.
use std::io;
use std::sync::Mutex;

static SPAWN: Mutex<()> = Mutex::new(());

pub fn locked<T>(spawn: impl FnOnce() -> io::Result<T>) -> io::Result<T> {
    let guard = SPAWN
        .lock()
        .map_err(|error| io::Error::other(format!("process_spawn_lock_failed: {error}")))?;
    let result = spawn();
    drop(guard);
    result
}