Skip to content

Run selected spawned commands in extension workers - #201

Open
demrom wants to merge 6 commits into
holzschu:masterfrom
demrom:feature/posix-spawn-workers
Open

demrom wants to merge 6 commits into
holzschu:masterfrom
demrom:feature/posix-spawn-workers

Conversation

@demrom

@demrom demrom commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Builds on holzschu/a-shell#1089.

Native commands selected by ASHELL_WORKER_COMMANDS run in a free extension worker through the run_function hook, without worker-specific code in the command. A full pool or unavailable worker API keeps the existing thread path. The explicit ios_posix_spawn API admits a worker before returning its PID and supports standard-stream file actions, cwd, wait status and resource usage; an unavailable provider returns ENOTSUP.

Detached completion preserves the parent's cwd and session status, and cancellation releases only the child's reservation. The low-level ios_execv_async entry point is included; wiring Dash background syntax to it is a separate change. wc, grep, cksum/sum and the output-open failure in gzip now preserve caller-owned streams, so successful counting does not become a worker cleanup error.

On an iPhone 16 Pro, a three-worker build passed 11 worker-pool-check cases plus four ios_system spawn/nested-environment cases and the next ordinary command after each, including nested environment, cancellation, capacity, resource usage and PID reuse. Both gzip/wc pipeline gates passed with separate stderr and 2,000,633 output bytes matching the thread path. The same suite passed in the Simulator using released Dash code and a login profile containing alias exit=clear; additional Simulator consumers verified exact output/status and caller-stream lifetime for five wc modes, grep/egrep/fgrep, cksum/sum and gzip's output-open error. Earlier Simulator regressions also cover missing-provider failure, detached cwd/status, interrupted children and thread-start failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant