Skip to main content

ShellExecutor

Struct ShellExecutor 

Source
pub struct ShellExecutor {
Show 57 fields pub functions: HashMap<String, ShellCommand>, pub aliases: HashMap<String, String>, pub global_aliases: HashMap<String, String>, pub suffix_aliases: HashMap<String, String>, pub last_status: i32, pub variables: HashMap<String, String>, pub arrays: HashMap<String, Vec<String>>, pub assoc_arrays: HashMap<String, HashMap<String, String>>, pub jobs: JobTable, pub fpath: Vec<PathBuf>, pub zwc_cache: HashMap<PathBuf, ZwcFile>, pub positional_params: Vec<String>, pub history: Option<HistoryEngine>, pub traps: HashMap<String, String>, pub options: HashMap<String, bool>, pub completions: HashMap<String, CompSpec>, pub dir_stack: Vec<PathBuf>, pub comp_matches: Vec<CompMatch>, pub comp_groups: Vec<CompGroup>, pub comp_state: CompState, pub zstyles: Vec<ZStyle>, pub comp_words: Vec<String>, pub comp_current: i32, pub comp_prefix: String, pub comp_suffix: String, pub comp_iprefix: String, pub comp_isuffix: String, pub readonly_vars: HashSet<String>, pub local_save_stack: Vec<(String, Option<String>)>, pub local_scope_depth: usize, pub autoload_pending: HashMap<String, AutoloadFlags>, pub hook_functions: HashMap<String, Vec<String>>, pub named_dirs: HashMap<String, PathBuf>, pub zptys: HashMap<String, ZptyState>, pub open_fds: HashMap<i32, File>, pub next_fd: i32, pub scheduled_commands: Vec<ScheduledCommand>, pub profile_data: HashMap<String, ProfileEntry>, pub profiling_enabled: bool, pub unix_sockets: HashMap<i32, UnixSocketState>, pub compsys_cache: Option<CompsysCache>, pub compinit_pending: Option<(Receiver<CompInitBgResult>, Instant)>, pub plugin_cache: Option<PluginCache>, pub deferred_compdefs: Vec<Vec<String>>, pub command_hash: HashMap<String, String>, pub pcre_state: PcreState, pub tcp_sessions: TcpSessions, pub zftp: Zftp, pub profiler: Profiler, pub style_table: StyleTable, pub zsh_compat: bool, pub posix_mode: bool, pub worker_pool: Arc<WorkerPool>, pub intercepts: Vec<Intercept>, pub async_jobs: HashMap<u32, Receiver<(i32, String)>>, pub next_async_id: u32, pub defer_stack: Vec<Vec<String>>, /* private fields */
}

Fields§

§functions: HashMap<String, ShellCommand>§aliases: HashMap<String, String>§global_aliases: HashMap<String, String>§suffix_aliases: HashMap<String, String>§last_status: i32§variables: HashMap<String, String>§arrays: HashMap<String, Vec<String>>§assoc_arrays: HashMap<String, HashMap<String, String>>§jobs: JobTable§fpath: Vec<PathBuf>§zwc_cache: HashMap<PathBuf, ZwcFile>§positional_params: Vec<String>§history: Option<HistoryEngine>§traps: HashMap<String, String>§options: HashMap<String, bool>§completions: HashMap<String, CompSpec>§dir_stack: Vec<PathBuf>§comp_matches: Vec<CompMatch>§comp_groups: Vec<CompGroup>§comp_state: CompState§zstyles: Vec<ZStyle>§comp_words: Vec<String>§comp_current: i32§comp_prefix: String§comp_suffix: String§comp_iprefix: String§comp_isuffix: String§readonly_vars: HashSet<String>§local_save_stack: Vec<(String, Option<String>)>

Stack for local variable save/restore (name, old_value).

§local_scope_depth: usize

Current function scope depth for local tracking.

§autoload_pending: HashMap<String, AutoloadFlags>§hook_functions: HashMap<String, Vec<String>>§named_dirs: HashMap<String, PathBuf>§zptys: HashMap<String, ZptyState>§open_fds: HashMap<i32, File>§next_fd: i32§scheduled_commands: Vec<ScheduledCommand>§profile_data: HashMap<String, ProfileEntry>§profiling_enabled: bool§unix_sockets: HashMap<i32, UnixSocketState>§compsys_cache: Option<CompsysCache>§compinit_pending: Option<(Receiver<CompInitBgResult>, Instant)>§plugin_cache: Option<PluginCache>§deferred_compdefs: Vec<Vec<String>>§command_hash: HashMap<String, String>§pcre_state: PcreState§tcp_sessions: TcpSessions§zftp: Zftp§profiler: Profiler§style_table: StyleTable§zsh_compat: bool

zsh compatibility mode - use .zcompdump, fpath scanning, etc.

§posix_mode: bool

POSIX sh strict mode — no SQLite, no worker pool, no zsh extensions

§worker_pool: Arc<WorkerPool>

Worker thread pool for background tasks (compinit, process subs, etc.)

§intercepts: Vec<Intercept>

AOP intercept table: command/function name → advice chain. Glob patterns supported (e.g. “git ”, “”).

§async_jobs: HashMap<u32, Receiver<(i32, String)>>

Async job handles: id → receiver for (status, stdout)

§next_async_id: u32

Next async job ID

§defer_stack: Vec<Vec<String>>

Defer stack: commands to run on scope exit (LIFO).

Implementations§

Source§

impl ShellExecutor

Source

pub fn new() -> ShellExecutor

Source

pub fn enter_posix_mode(&mut self)

Enter POSIX strict mode — drop all SQLite caches, shrink worker pool to minimum. No zsh extensions, no caching, no threads beyond the bare minimum. Dinosaur mode.

Source

pub fn run_hooks(&mut self, hook_name: &str)

Run hook functions (precmd, preexec, chpwd, etc.)

Source

pub fn add_hook(&mut self, hook_name: &str, func_name: &str)

Add a function to a hook

Source

pub fn add_named_dir(&mut self, name: &str, path: &str)

Add a named directory (hash -d name=path)

Source

pub fn expand_tilde_named(&self, path: &str) -> String

Expand ~ with named directories

Source

pub fn autoload_function(&mut self, name: &str) -> Option<ShellCommand>

Try to load a function from ZWC files in fpath

Source

pub fn add_fpath(&mut self, path: PathBuf)

Add a directory to fpath

Source

pub fn glob_match_static(s: &str, pattern: &str) -> bool

Static glob match — same logic as glob_match but callable without &self, needed for Rayon parallel iterators that can’t capture &self.

Source

pub fn execute_script_file(&mut self, file_path: &str) -> Result<i32, String>

Execute a script file with bytecode caching — skips lex+parse+compile on cache hit. The AST is stored in SQLite keyed by (path, mtime).

Source

pub fn execute_script(&mut self, script: &str) -> Result<i32, String>

Source

pub fn execute_command(&mut self, cmd: &ShellCommand) -> Result<i32, String>

Source

pub fn maybe_autoload(&mut self, name: &str) -> bool

Check if a function is autoload pending and load it if so

Source§

impl ShellExecutor

Source

pub fn run_trap(&mut self, signal: &str)

Execute trap handlers for a signal

Source

pub fn drain_compinit_bg(&mut self)

Non-blocking drain of background compinit results. Call this before any completion lookup (prompt, tab-complete, etc.). If the background thread hasn’t finished yet, this is a no-op.

Source

pub fn zfork(&mut self, flags: ForkFlags) -> Result<ForkResult, Error>

Fork a new process Port of zfork() from exec.c

Source

pub fn zexecve(&self, cmd: &str, args: &[String]) -> !

Execute a command in the current process (exec family) Port of zexecve() from exec.c

Source

pub fn entersubsh(&mut self, flags: SubshellFlags)

Enter a subshell Port of entersubsh() from exec.c

Source

pub fn doshfunc( &mut self, name: &str, func: &ShellCommand, args: &[String], ) -> Result<i32, String>

Execute a shell function Port of doshfunc() from exec.c

Source

pub fn execarith(&mut self, expr: &str) -> i32

Execute arithmetic expression Port of execarith() from exec.c

Source

pub fn execcond(&mut self, cond: &CondExpr) -> i32

Execute conditional expression Port of execcond() from exec.c

Source

pub fn exectime(&mut self, cmd: &ShellCommand) -> Result<i32, String>

Execute command and capture time Port of exectime() from exec.c

Source

pub fn findcmd(&self, name: &str, do_hash: bool) -> Option<String>

Find command in PATH Port of findcmd() from exec.c

Source

pub fn hashcmd(&mut self, name: &str, path: &str)

Hash a command (add to command hash table) Port of hashcmd() from exec.c

Source

pub fn iscom(&self, name: &str) -> bool

Check if command exists and is executable Port of iscom() from exec.c

Source

pub fn closem(&self, exceptions: &[i32])

Close all file descriptors except stdin/stdout/stderr Port of closem() from exec.c

Source

pub fn mpipe(&self) -> Result<(i32, i32), Error>

Create a pipe Port of mpipe() from exec.c

Source

pub fn addfd( &self, fd: i32, target_fd: i32, mode: RedirMode, ) -> Result<(), Error>

Add a file descriptor for redirection Port of addfd() from exec.c

Source

pub fn gethere(&mut self, terminator: &str, strip_tabs: bool) -> String

Get heredoc content Port of gethere() from exec.c

Source

pub fn getherestr(&mut self, word: &str) -> String

Get herestring content Port of getherestr() from exec.c

Source

pub fn resolvebuiltin(&self, name: &str) -> Option<BuiltinType>

Resolve a builtin command Port of resolvebuiltin() from exec.c

Source

pub fn cancd(&self, path_str: &str) -> bool

Check if cd is possible Port of cancd() from exec.c

Source

pub fn commandnotfound(&mut self, name: &str, args: &[String]) -> i32

Command not found handler Port of commandnotfound() from exec.c

Trait Implementations§

Source§

impl Default for ShellExecutor

Source§

fn default() -> ShellExecutor

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more