Skip to main content

dispatch

Function dispatch 

Source
pub fn dispatch(name: &str, argv: &[String]) -> Option<i32>
Expand description

Run name with argv (argv[0] included) if it is registered.

Returns None when the name is not ours, so callers fall through to their existing next step — PATH lookup, or “command not found”.

The read lock is held for the duration of the call. That is deliberate: nothing ever removes an entry, and the alternative (clone the boxed closure out) is not possible for a dyn Fn. Re-entrant dispatch — a native command that runs shell code that runs another native command — takes the read lock twice, which an RwLock grants.