Run: shortcomings found, and the fixes so far (2026-10-30 to 2026-11-01)

Run is the user's process-spawning module (Run-0.04.tar.gz-base64.txt in this project), studied as a back end for executing ShellSubset parse trees. This document collects what was found wrong or missing, and what was fixed in the versions made in this project (0.05 and 0.06, claude/Run-0.05.tar.gz-base64.txt, claude/Run-0.06.tar.gz-base64.txt). The detailed history is in claude/run-executor-investigation.md and claude/run-executor-upstream-reports.md; the redesign discussion is on the checklist pages "Run 0.07 Jobs" and "Run Graph API".

Since 2026-11-01 the executor for the simplest scenario uses posix_spawn(3) instead (claude/pspawn-design.md). Run stays relevant where there is no posix_spawn (Win32, OS/2), see the last section.

1. Bugs, all fixed

| ID | Shortcoming (0.04) | Fix | In | |---|---|---|---| | R1 | new_system('a b') with one element went through system STRING: shell metacharacters reached /bin/sh, and a program name with a blank was split. | Tree nodes always use exec { PROG } LIST / system { PROG } LIST; the exported spawn keeps the builtin's one-string meaning. | 0.05 | | R2 | File targets were opened with 2-argument open: - meant STDOUT, &1 meant a dup, leading blanks were dropped, <> could not create a file. | {filename => NAME, mode => OP} opens NAME literally with sh's < > >| >> <> (sysopen). The old form stays. | 0.05 | | R3 | $data->{result} was set only on failure and never reset; new_chain failed if any command failed. | result is the $? of every command (0 included) or -1 if nothing started; new_chain succeeds iff its last command does. | 0.05 | | R4 | new_readpipe never reaped its kid (one zombie per call; status lost). | The kid is reaped and its status kept. | 0.05 | | R5 | Forkless: the exec-error pipe of the emulated spawn could land on an fd that a redirection had just closed under a Perl handle; PerlIO counted two owners, never closed the fd, and the parent hung. Seen only under prove, depending on which fds were free. | close_fd() closes such handles at the fd level too. 30 of 62 fd placements hung before, none after. | 0.06 | | — | An exec failure was reported twice (and warned under -w); messages showed a stale $!. | One message, no stale $!. | 0.05 | | — | First draft of new_pipeline (0.05): a die inside a forked copy escaped it; its messages were lost; result was stale in error paths. Found by a cold review. | Fixed before 0.05 was published. | 0.05 |

2. Design limits of the 0.04 tree layer

3. Problems of the environment, with the remedies found

4. What stays relevant if posix_spawn is used