pub struct CommandCustody { /* private fields */ }Expand description
One command’s inheritable sidecar custody, acquired without waiting.
Dropping closes the owner descriptor without unlocking inherited copies. Descendants must preserve that descriptor for their entire relevant lifetime.
Implementations§
Source§impl CommandCustody
impl CommandCustody
Sourcepub fn acquire(path: &Path) -> Result<Self, CustodyError>
pub fn acquire(path: &Path) -> Result<Self, CustodyError>
Open/create a private regular sidecar in an existing parent and try its lock.
Existing bytes and permissions are preserved. Creation is not synchronized. Only the final component is no-follow; callers trust and stabilize parents.
§Errors
Returns entry, lock contention and native I/O failures, retaining the sidecar.
Sourcepub const fn identity(&self) -> FileIdentity
pub const fn identity(&self) -> FileIdentity
Read the observed identity for caller-owned retention before dispatch.
Sourcepub fn spawn(
&mut self,
command: Command,
descriptor_environment: &str,
) -> Result<Child, CustodyError>
pub fn spawn( &mut self, command: Command, descriptor_environment: &str, ) -> Result<Child, CustodyError>
Attempt one command with a duplicated descriptor named by its environment.
Recheck the sidecar identity before consuming the single spawn allowance. Duplication and spawn failures consume that allowance too. The owner stays close-on-exec; the command’s parent-side copy is closed before returning. Callers own argv/environment admission, output bounds, deadlines and reaping.
§Errors
Returns replacement, repeated-dispatch, descriptor or spawn failures.
Sourcepub fn finish(
self,
grace: Duration,
poll_interval: Duration,
) -> Result<QuiescenceGuard, CustodyError>
pub fn finish( self, grace: Duration, poll_interval: Duration, ) -> Result<QuiescenceGuard, CustodyError>
Close owner custody and probe exact quiescence within caller-selected grace.
Retry only contention. A zero grace performs one probe; polling must be nonzero. Filesystem operations have no wall-clock deadline. Failure retains the original sidecar and establishes no remote outcome or retry authority.
§Errors
Returns invalid timing, active inherited holders, replacement or I/O failure.