pub struct SubshellSnapshot {
pub variables: HashMap<String, String>,
pub arrays: HashMap<String, Vec<String>>,
pub assoc_arrays: HashMap<String, IndexMap<String, String>>,
pub positional_params: Vec<String>,
pub env_vars: HashMap<String, String>,
pub cwd: Option<PathBuf>,
pub umask: u32,
pub traps: HashMap<String, String>,
}Expand description
Snapshot of subshell-isolated state. Captured at ( entry, restored at
) exit. zsh subshell semantics: assignments inside (…) don’t leak to
the outer scope — and that includes export. zsh forks a child for the
subshell so the child’s env::set_var dies with the child; without a fork
(zshrs runs subshells in-process for perf), we snapshot+restore the OS
env table around the subshell. Otherwise (export y=v) would leak y
to the parent shell, breaking every script that uses a subshell to
scope an env override.
Fields§
§variables: HashMap<String, String>§arrays: HashMap<String, Vec<String>>§assoc_arrays: HashMap<String, IndexMap<String, String>>§positional_params: Vec<String>§env_vars: HashMap<String, String>§cwd: Option<PathBuf>Process working directory at subshell entry. cd inside the
subshell shouldn’t leak to the parent; we restore on End.
umask: u32File-creation mask at subshell entry. zsh forks for (...) so
umask set inside dies with the child; we run subshells in
process so we must restore the mask on End. Otherwise
umask 022; (umask 077); umask shows 077 in the parent.
traps: HashMap<String, String>Parent’s traps at subshell entry. zsh’s (trap "echo X" EXIT; true) runs the trap when the subshell exits — BEFORE the parent
continues. Without this snapshot, the trap inherited from parent
would fire, OR a trap set inside the subshell would leak to the
parent’s process exit. Restored on subshell_end after the
subshell’s own EXIT trap (if any) has fired.
Auto Trait Implementations§
impl Freeze for SubshellSnapshot
impl RefUnwindSafe for SubshellSnapshot
impl Send for SubshellSnapshot
impl Sync for SubshellSnapshot
impl Unpin for SubshellSnapshot
impl UnsafeUnpin for SubshellSnapshot
impl UnwindSafe for SubshellSnapshot
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.