MCPcopy Create free account
hub / github.com/saltstack/salt / run_stderr

Function run_stderr

salt/modules/cmdmod.py:2020–2259  ·  view source on GitHub ↗

Execute a command and only return the standard error :param str cmd: The command to run. ex: ``ls -lart /home`` :param str cwd: The directory from which to execute the command. Defaults to the home directory of the user specified by ``runas`` (or the user under which S

(
    cmd,
    cwd=None,
    stdin=None,
    runas=None,
    group=None,
    shell=DEFAULT_SHELL,
    python_shell=None,
    env=None,
    clean_env=False,
    template=None,
    rstrip=True,
    umask=None,
    output_encoding=None,
    output_loglevel="debug",
    log_callback=None,
    hide_output=False,
    timeout=None,
    reset_system_locale=True,
    ignore_retcode=False,
    saltenv=None,
    use_vt=False,
    password=None,
    prepend_path=None,
    success_retcodes=None,
    success_stdout=None,
    success_stderr=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

2018
2019
2020def run_stderr(
2021 cmd,
2022 cwd=None,
2023 stdin=None,
2024 runas=None,
2025 group=None,
2026 shell=DEFAULT_SHELL,
2027 python_shell=None,
2028 env=None,
2029 clean_env=False,
2030 template=None,
2031 rstrip=True,
2032 umask=None,
2033 output_encoding=None,
2034 output_loglevel="debug",
2035 log_callback=None,
2036 hide_output=False,
2037 timeout=None,
2038 reset_system_locale=True,
2039 ignore_retcode=False,
2040 saltenv=None,
2041 use_vt=False,
2042 password=None,
2043 prepend_path=None,
2044 success_retcodes=None,
2045 success_stdout=None,
2046 success_stderr=None,
2047 **kwargs,
2048):
2049 """
2050 Execute a command and only return the standard error
2051
2052 :param str cmd: The command to run. ex: ``ls -lart /home``
2053
2054 :param str cwd: The directory from which to execute the command. Defaults
2055 to the home directory of the user specified by ``runas`` (or the user
2056 under which Salt is running if ``runas`` is not specified).
2057
2058 :param str stdin: A string of standard input can be specified for the
2059 command to be run using the ``stdin`` parameter. This can be useful in
2060 cases where sensitive information must be read from standard input.
2061
2062 :param str runas: Specify an alternate user to run the command. The default
2063 behavior is to run as the user under which Salt is running.
2064
2065 .. warning::
2066
2067 For versions 2018.3.3 and above on MacOS while using runas,
2068 to pass special characters to the command you need to escape
2069 the characters on the shell.
2070
2071 Example:
2072
2073 .. code-block:: bash
2074
2075 cmd.run_stderr 'echo '\\''h=\\"baz\\"'\\''' runas=macuser
2076
2077 :param str password: Windows only. The password for the account specified

Callers

nothing calls this directly

Calls 3

_python_shell_defaultFunction · 0.85
_runFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected