Registry
The registry is stored in global associative arrays:
CO_PROC_IN[$name]
CO_PROC_OUT[$name]
CO_PROC_PID[$name]
CO_PROC_CMD[$name]
CO_PROC_STARTED[$name]
CO_PROC_EXIT[$name]
CO_PROC_CURRENT stores the current process name.
These arrays are intentionally simple. They are useful for inspection and tests,
but callers should prefer commands such as co-proc info, co-proc list, and
co-proc switch.
Lifecycle
co-proc startcalls nativecoproc COMMAND.- It captures output and input descriptors from
p. - It records descriptors and pid in the registry.
co-proc sendwrites toCO_PROC_IN[$name].co-proc readreads fromCO_PROC_OUT[$name].co-proc stop,wait, orprunecloses descriptors and updates registry state.
co-proc installs a zshexit hook through add-zsh-hook so registered
processes are cleaned up when the shell exits.