MCPcopy Index your code
hub / github.com/python/cpython / getoutput

Function getoutput

Lib/subprocess.py:687–697  ·  view source on GitHub ↗

Return output (stdout or stderr) of executing cmd in a shell. Like getstatusoutput(), except the exit status is ignored and the return value is a string containing the command's output. Example: >>> import subprocess >>> subprocess.getoutput('ls /bin/ls') '/bin/ls'

(cmd, *, encoding=None, errors=None)

Source from the content-addressed store, hash-verified

685 return exitcode, data
686
687def getoutput(cmd, *, encoding=None, errors=None):
688 """Return output (stdout or stderr) of executing cmd in a shell.
689
690 Like getstatusoutput(), except the exit status is ignored and the return
691 value is a string containing the command's output. Example:
692
693 >>> import subprocess
694 >>> subprocess.getoutput('ls /bin/ls')
695 '/bin/ls'
696 """
697 return getstatusoutput(cmd, encoding=encoding, errors=errors)[1]
698
699
700

Callers

nothing calls this directly

Calls 1

getstatusoutputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…