Skip to content

fix(wasix): complete built-in subprocesses and support version flags - #6875

Open
theduke wants to merge 4 commits into
mainfrom
run-1088-wasix-propagate-virtual-command-completion
Open

fix(wasix): complete built-in subprocesses and support version flags#6875
theduke wants to merge 4 commits into
mainfrom
run-1088-wasix-propagate-virtual-command-completion

Conversation

@theduke

@theduke theduke commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

What and why

A WASIX guest running Command::new("wasmer").arg("--version").output() printed wasmer run usage and then waited forever.

Two independent problems caused this:

  • The built-in wasmer command did not recognize -V or --version.
  • proc_spawn3 and legacy proc_spawn discarded the built-in task handle, so its completion never reached the forked child process observed by waitpid/proc_join.

Fix

The built-in now prints wasmer <version> to its child stdout, honoring pipe and file redirections used by Command::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 --version with 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, and cargo clippy -p wasmer-wasix --lib --features sys-thread -- -D warnings.

Fixes #6873
Fixes #6874

Linear: RUN-1088, RUN-1089

@theduke
theduke requested review from Arshia001 and a lite review from Copilot August 7, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_spawn3 and legacy proc_spawn.
  • Add -V/--version support to the WASIX built-in wasmer command 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;
}
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.

WASIX: support -V and --version in the built-in wasmer command WASIX: propagate virtual-command completion to spawned processes

2 participants