Repository navigation
Conversation
worker-sys: extend the Container extern block with exec()/ExecProcess/ ExecOutput, binding Cloudflare's exec() API for running an additional process inside an already-running container and reading its exit code and buffered stdout/stderr. worker: extend ContainerStartupOptions with image/instance/ container_snapshot/labels (the durable_object scheduling policy's additional ctx.container.start() fields, previously unavailable; the default policy's image/instance come from Wrangler config instead) and add idiomatic Container::exec()/ExecProcess/ExecOutput wrappers. Source: https://developers.cloudflare.com/containers/api/durable-object-container/ and https://developers.cloudflare.com/containers/configuration/scheduling-policy/, checked 2026-10-02.
…p builders set_custom_instance and set_container_snapshot built their JS object with Reflect::set(...).unwrap(). Reflect::set can fail per the ECMAScript spec (js-sys surfaces that as a Result), and this code runs inside a Worker request handler, so an avoidable unwrap() is an avoidable panic there. Both methods now return Result<(), JsValue> and propagate with ?, matching Container::exec's existing ?-based error propagation in this same file.
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
Scope and ordering
This combines the original exec/sizing foundation with its record-serialization correction so the first mergeable contribution does not expose the known broken conversion path. Native Container streaming/loopback capabilities are a separate dependent contribution and must land after this PR.
The exec wrapper here supports buffered output; stream stdin/stdout/stderr, abort signals, and PTY support are not part of this contribution. The existing start/monitor/signal/destroy/TCP-port method signatures remain unchanged. ContainerStartupOptions gains public fields, so exhaustive Rust struct literals need to include them or use new()/Default.
Verification
CARGO_HOME=~/.local/share/cargowithwasm-bindgen-test-runner 0.2.129and Node.js 26.13.1, rancargo test --manifest-path ../workers-rs-env-record-upstream/Cargo.toml -p worker --target wasm32-unknown-unknown --lib container::tests; result: 4 passed, 4 filtered, 0.01s.References