fix(wasix): complete built-in subprocesses and support version flags - #6875
Open
theduke wants to merge 4 commits into
Open
fix(wasix): complete built-in subprocesses and support version flags#6875theduke wants to merge 4 commits into
theduke wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a WASIX subprocess hang when spawning built-in commands (notably wasmer --version) by (1) adding -V/--version handling to the built-in wasmer virtual command and (2) propagating completion of built-in virtual-command tasks to the spawned child process so waitpid/proc_join can observe termination. It also adds a regression test that spawns wasmer --version, captures stdout/stderr via pipes, and waits for exit.
Changes:
- Relay built-in virtual-command task completion to the forked/spawned child process status in both
proc_spawn3and legacyproc_spawn. - Add
-V/--versionsupport to the WASIX built-inwasmercommand and write version output to child stdout (respecting redirection). - Add a WASIX C fixture regression test that spawns
wasmer --version, reads stdout/stderr pipes, and asserts exit/status/output.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/wasix/tests/wasm_tests/process/builtin-wasmer-version/main.c | New regression fixture that spawns wasmer --version, captures output via pipes, and waits for termination. |
| lib/wasix/src/syscalls/wasix/proc_spawn3.rs | Propagates built-in virtual-command completion to the spawned child process in the WASIX ABI v3 spawn path. |
| lib/wasix/src/syscalls/wasix/proc_spawn.rs | Propagates built-in virtual-command completion to the spawned child process in the legacy spawn path. |
| lib/wasix/src/syscalls/wasix/mod.rs | Adds the shared propagate_virtual_task_completion() helper used by both spawn paths. |
| lib/wasix/src/os/command/builtins/cmd_wasmer.rs | Adds -V/--version flag support and writes version output to child stdout honoring redirection/pipes. |
| } | ||
| }; | ||
|
|
||
| let mut file = handle.write().unwrap(); |
Comment on lines
+77
to
+80
| if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { | ||
| fprintf(stderr, "wasmer exited with status %d\n", status); | ||
| return 1; | ||
| } |
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.
What and why
A WASIX guest running
Command::new("wasmer").arg("--version").output()printedwasmer runusage and then waited forever.Two independent problems caused this:
wasmercommand did not recognize-Vor--version.proc_spawn3and legacyproc_spawndiscarded the built-in task handle, so its completion never reached the forked child process observed bywaitpid/proc_join.Fix
The built-in now prints
wasmer <version>to its child stdout, honoring pipe and file redirections used byCommand::output(). Spawned virtual-command completion is relayed to the child process for both current and legacy spawn paths, including asynchronously completing commands.Regression coverage
A C WASIX fixture spawns
wasmer --versionwith child stdout/stderr pipes, reads the captured output, and waits for exit. Before the fix it timed out; it now verifies version output on stdout, empty stderr, and exit status 0 in both the legacy and current ABI configurations.Validated with focused Cranelift tests for both configurations,
cargo fmt, andcargo clippy -p wasmer-wasix --lib --features sys-thread -- -D warnings.Fixes #6873
Fixes #6874
Linear: RUN-1088, RUN-1089