Problem
exec is intentionally excluded (TM-ESC-005) because it cannot replace the shell process in a sandbox. However, exec is commonly used in scripts to hand off to another command as the final action, and the current behavior (silent failure or error) breaks real-world scripts.
Impact
Scripts that use exec for plugin dispatch or command delegation fail entirely. Example from wedow/ticket (line 1351):
This is the plugin system's dispatch mechanism — without it, tk list, tk query, tk edit, and all plugin commands are broken.
Proposal
Implement exec as "run the command and exit with its exit code" — which is semantically equivalent in a sandboxed environment where there's no real process to replace:
exec some_command args...
# Equivalent to:
some_command args...
exit $?
This preserves the security invariant (no process replacement / sandbox escape) while supporting the common exec usage pattern. The exec with only redirections (exec 3>file) can remain unsupported or be a separate follow-up.
Security notes
- No actual process replacement — just run + exit
- FD-only
exec (no command) can error explicitly
- Stays within sandbox containment (TM-ESC-005)
- Document the difference from real exec in specs
Problem
execis intentionally excluded (TM-ESC-005) because it cannot replace the shell process in a sandbox. However,execis commonly used in scripts to hand off to another command as the final action, and the current behavior (silent failure or error) breaks real-world scripts.Impact
Scripts that use
execfor plugin dispatch or command delegation fail entirely. Example from wedow/ticket (line 1351):This is the plugin system's dispatch mechanism — without it,
tk list,tk query,tk edit, and all plugin commands are broken.Proposal
Implement
execas "run the command and exit with its exit code" — which is semantically equivalent in a sandboxed environment where there's no real process to replace:This preserves the security invariant (no process replacement / sandbox escape) while supporting the common
execusage pattern. Theexecwith only redirections (exec 3>file) can remain unsupported or be a separate follow-up.Security notes
exec(no command) can error explicitly