Skip to main content

Module posix

Module posix 

Source
Expand description

The POSIX tab wrapper, the shell expressions it embeds, and the terminal walk and tab commands.

Enums§

Terminal

Constants§

BOOT_ID_EXPR_POSIX
The boot id as the wrapper writes it (spec Pairing, lines 322-331). POSIX sh text valid under dash; embedded as $(<EXPR>) by wrapper_script_posix.
PATH_ORDER 🔒
The four POSIX terminals in the spec’s PATH order.
STARTTIME_EXPR_POSIX
Field 22 of /proc/$$/stat: the 20th token after the last ) ($$ inside $(...) is the shell’s pid; measured under dash).

Functions§

process_name 🔒
quote_sh
Single-quote a value for POSIX sh: every ' becomes '\''.
select_terminal
FIRST the terminal found by walking the parent process names (nearest first), and ONLY when no parent matches the first of the four on PATH, in the spec’s order. Windows: wt when on PATH.
system_parent_chain
The names of this process’s ancestors, nearest first (the parent’s basename of /proc/<pid>/cmdline’s first element on Linux, ps -o comm= on macOS; empty elsewhere).
tab_command
The tab command, program first (spec Launcher step 4). mate-terminal and xfce4-terminal split the ONE -e string with g_shell_parse_argv, so that element is the script path single-quoted with every ' written as '\''; gnome-terminal and konsole take argv elements and get the raw path.
terminal_for_process 🔒
wrapper_script_posix
The bash tab wrapper. It writes tui-pid ($$:<boot_id>:<starttime>, no newline) at its start and tui-exited (epoch ms) from its EXIT trap, both under a umask 077 subshell so the sentinels are 0600 without changing the umask opencode runs under.