Subprocess helpers

Import process and async_process from rmote.process. Tools that use these helpers transfer the module on demand, through the ordinary module loader. The helpers are absent from the initial protocol bootstrap.

async rmote.process.async_process(*cmd_and_args, stdin=None, capture_output=False, text=False, env=None, shell=False, check=False, cwd=None, timeout=None)[source]

Run a child asynchronously without sharing the RPC stdout/stderr pipes.

Arguments and results follow process(). Shell mode accepts one expression. Text mode uses the locale encoding and universal newlines; string stdin in binary mode uses UTF-8. Output is discarded unless captured.

timeout limits communication after spawn, in seconds; None disables it. Timeout raises subprocess.TimeoutExpired with captured bytes. Cancellation and timeout kill the POSIX child process group and reap the direct child. This local cleanup does not change RPC cancellation semantics: cancelling a caller’s RPC does not itself stop a remote operation.

Return type:

CompletedProcess[Any]

rmote.process.process(*cmd_and_args, stdin=None, capture_output=False, text=False, env=None, shell=False, check=False, cwd=None)[source]

function for execute a subprocess on the remote side, must be safe, do not share stdout/stderr of the child process, because it’s protocol pipes.

Tools must use this function or async_process to execute subprocesses, to avoid conflicts with protocol communication.

String stdin is encoded in binary mode. Text mode requires string stdin.

Return type:

CompletedProcess[Any]