Docs: Updated docstring of run_through_shell.

This commit is contained in:
Lukáš Mandák 2015-09-25 18:47:54 +02:00
parent 30b73fe6d6
commit 4aa6b2a73c

View File

@ -7,11 +7,21 @@ CommandResult = namedtuple("Result", ['rc', 'out', 'err'])
def run_through_shell(command, enable_shell=False):
"""
Retrieves output of command
Returns tuple success (boolean)/ stdout(string) / stderr (string)
Retrieve output of a command.
Returns a named tuple with three elements:
Don't use this function with programs that outputs lots of data since the output is saved
in one variable
* ``rc`` (integer) Return code of command.
* ``out`` (string) Everything that was printed to stdout.
* ``err`` (string) Everything that was printed to stderr.
Don't use this function with programs that outputs lots of data since the
output is saved in one variable.
:param command: A string or a list of strings containing the name and
arguments of the program.
:param enable_shell: If set ot `True` users default shell will be invoked
and given ``command`` to execute. The ``command`` should obviously be a
string since shell does all the parsing.
"""
if not enable_shell and not isinstance(command, list):