Add real std.proc.run process API (host runtime)#119
Open
WalterGropius wants to merge 3 commits into
Open
Conversation
Implement zero_proc_run_result with fork+execvp, three pipes, non-blocking drain into caller buffers, and SIGKILL on timeout. Argv is decoded from a flat length-prefixed blob so the runtime boundary stays a plain byte view. Regenerate the embedded runtime sources. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add ProcResult type, signatures for std.proc.run/outLen/errLen/ timedOut, IR value kinds, and lowering modeled on std.http.fetch. The native-exe backends reject the nine-argument runtime call with CGEN004 until the extended calling convention is available; the host runtime and surface are complete. Legacy spawn/exitCode are preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rewrite the proc module doc for the argv-vector API and the host-only / calling-convention gating. Add std-proc-run.0 exercising echo capture, error exit, and timeout flags, and register it in the type-check conformance set alongside the existing host-only proc fixture. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@WalterGropius is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Local machine verification (darwin-arm64, clean build of native/zero-c, no warnings):
Gating signals (conformance + command-contracts) are green. Marking ready. |
| } | ||
|
|
||
| int32_t zero_proc_run_exit_code(uint64_t result) { | ||
| return (int32_t)((result >> 48) & 0xffu); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the no-op
std.proc.spawnfiction with a real process API.std.proc.runexecutes an argv vector (no shell) with three pipes, captures stdout/stderr into caller buffers, feeds stdin, and SIGKILLs on timeout. Returns aProcResultu64 handle withexitCode/outLen/errLen/timedOutaccessors. Legacyspawn/exitCodeare preserved.Source
Addresses P0-4. Reproduction confirmed against main @ 5b91e7f:
ir.cloweredstd.proc.spawnto the integer literal0and ran nothing (docs-site/articles/modules/proc.mddescribed it as merely "creates a process status").std.proc.run/ProcResultdid not exist anywhere at HEAD.Changes
native/zero-c/runtime/zero_runtime.c+include/zero_runtime.h:zero_proc_run_result(fork + execvp + 3 pipes, non-blocking poll drain, SIGKILL on timeout) and packed-handle accessors. POSIX impl + Windows/unavailable fallback. No stub.native/zero-c/src/embedded_runtime_sources.inc: regenerated.checker.c/ir.c/include/zero.h/main.c:ProcResulttype, signatures forrun/outLen/errLen/timedOut, IR value kinds + lowering modeled onstd.http.fetch, helper registry +explainmetadata.docs-site/articles/modules/proc.md: rewritten for the argv-vector API and host-only / calling-convention gating.conformance/native/pass/std-proc-run.0+conformance/run.mjs: fixture exercising echo capture, error-exit, and timeout flags; registered in the type-check set (matching the existing host-only proc fixture).Conformance
zero checkpasses for the new fixture and all touched fixtures (legacy spawnstd-platform-basics.0,std-http-fetch.0, thetarget-proc-unsupportedfail test,examples/std-platform.0) — no regressions.std.proc.runis correctly host-only: non-host targets reject withTAR002(capabilityproc), exactly asspawndoes today. The fixture is registered in the type-check set like the existing host-onlystd-platform-basics.0(no runtime loop, since proc is host-only and the host--emit exepath is itselfCGEN004-unsupported on the direct backend).std.proc.runtherefore depends on the extended calling convention (aggregate-ABI work) landing. The host runtime, type surface, and conformance coverage here are complete and correct.conformance:local/native:test:local/docs:testcould not be executed in the build sandbox (pnpm/harness invocation denied;docs:testadditionally needstypescriptworkspace deps installed). Reviewer should run these locally; individualzero checkgates were verified manually.Proposed CHANGELOG line
std.proc.run(argv, stdin, out, err, timeout) -> ProcResultwith real shell-free process execution and stdout/stderr capture;std.proc.spawnretained for compatibility.Note
A parallel agent worktree holds the
feat/std-proc-runbranch with an equivalent runtime/wiring implementation on a newer base but missing the docs + conformance fixture. This PR is pushed underfeat/std-proc-run-hostto avoid clobbering that branch; the docs/fixture/registration here are the complementary deliverables. Maintainers may prefer to consolidate.🤖 Generated with Claude Code