Skip to main content
Source: src/cwsandbox/_types.py:518
Handle for a running process with streaming stdout/stderr. Process inherits from OperationRef[ProcessResult] and adds streaming capabilities and process-specific methods. It wraps an async operation that executes a command in a sandbox. The process’s output streams (stdout, stderr) can be iterated either synchronously or asynchronously. The result() method blocks until completion and returns the full ProcessResult.

Properties

returncode

The process exit code, or None if not yet complete.

command

The command that was executed.

Methods

poll

Check if the process has completed without blocking. Returns
  • int | None: The exit code if the process has completed, None otherwise.

wait

Block until the process completes. Parameters
  • timeout (float | None): Maximum seconds to wait. None means wait forever.
Returns
  • int: The process exit code.
Raises
  • concurrent.futures.TimeoutError: If timeout expires.
  • concurrent.futures.CancelledError: If the operation was cancelled.
  • Exception: Any exception from the execution.

result

Block until complete and return the full ProcessResult. Parameters
  • timeout (float | None): Maximum seconds to wait. None means wait forever.
Returns
  • ProcessResult: The ProcessResult containing stdout, stderr, and exit code.
Raises
  • concurrent.futures.TimeoutError: If timeout expires.
  • concurrent.futures.CancelledError: If the operation was cancelled.
  • Exception: Any exception from the execution.

cancel

Attempt to cancel the process. Returns
  • bool: True if successfully cancelled, False otherwise.
Last modified on May 19, 2026