Exec¶
- class rmote.tools.exec.Exec[source]¶
Bases:
ToolRun commands and shell expressions on the remote host.
- static command(*args, check=True, env=None, cwd=None, stdin=None)[source]¶
Run a command with explicit argument list.
- Parameters:
*args (
Text) – Command and its arguments (e.g."ls","-la").check (
bool) – Raisesubprocess.CalledProcessErroron non-zero exit.env (
WSGIEnvironment[Text,Text] |None) – Override environment variables for the subprocess.cwd (
None|Text|Path) – Working directory; defaults to the remote process’s cwd.stdin (
None|Text|bytes) – Data written to stdin before the command reads it.
- Return type:
- Returns:
subprocess.CompletedProcesswithreturncode,stdout, andstderr.
- static shell(expression, check=True, env=None, cwd=None, stdin=None)[source]¶
Run expression through the remote shell (
/bin/sh -c).- Parameters:
expression (
Text) – Shell expression, including pipes, redirects, etc.check (
bool) – Raisesubprocess.CalledProcessErroron non-zero exit.env (
WSGIEnvironment[Text,Text] |None) – Override environment variables for the subprocess.cwd (
None|Text|Path) – Working directory; defaults to the remote process’s cwd.stdin (
None|Text|bytes) – Data written to stdin before the command reads it.
- Return type:
- Returns:
subprocess.CompletedProcesswithreturncode,stdout, andstderr.