pub fn run_command_substitution(cmd: &str) -> StringExpand description
!!! WARNING: RUST-ONLY HELPER !!!
No function of this name exists in Src/exec.c. This helper stands in for
running a $(...) body in-process on the live fusevm executor. C forks
and calls entersubsh(ESUB_PGRP|ESUB_NOMONITOR, NULL) inside getoutput
(c:4713); the in-process form applies that subshell state with a guard
instead.
Run a $(...) command substitution on the live executor, returning
captured stdout. Empty string when no executor is in scope.
The body runs IN-PROCESS (no fork), so the subshell state that
Src/exec.c:4781’s entersubsh(ESUB_PGRP|ESUB_NOMONITOR, NULL) would
have installed in the forked child is applied here by SubshStateGuard
and unwound when the substitution returns. Every caller of this funnel —
getoutput above and the p10k custom-segment renderer
(extensions/p10k/segments_core.rs:917, which is content="$(eval $command)") — is a genuine command substitution and wants it.