class_docstr: Execute subprocesses under the control of pexpect.
      
class_docstr_tok: ["Execute","subprocesses","under","the","control","of","pexpect","."]
docstr: Run a command and return its stdout/stderr as a string.
  
  Parameters
  ----------
  cmd : str
    A command to be executed in the system shell.
  
  Returns
  -------
  output : str
    A string containing the combination of stdout and stderr from the
  subprocess, in whatever order the subprocess originally wrote to its
  file descriptors (so the order of the information in this string is the
  correct order as would be seen if running the command in a terminal).
docstr_tok: ["Run","a","command","and","return","its","stdout\/stderr","as","a","string",".","Parameters","--","--","--","--","--","cmd",":","str","A","command","to","be","executed","in","the","system","shell",".","Returns","--","--","--","-","output",":","str","A","string","containing","the","combination","of","stdout","and","stderr","from","the","subprocess",",","in","whatever","order","the","subprocess","originally","wrote","to","its","file","descriptors","(","so","the","order","of","the","information","in","this","string","is","the","correct","order","as","would","be","seen","if","running","the","command","in","a","terminal",")","."]
code: def getoutput_pexpect(self, cmd):
      """Run a command and return its stdout/stderr as a string.
  
      Parameters
      ----------
      cmd : str
        A command to be executed in the system shell.
  
      Returns
      -------
      output : str
        A string containing the combination of stdout and stderr from the
      subprocess, in whatever order the subprocess originally wrote to its
      file descriptors (so the order of the information in this string is the
      correct order as would be seen if running the command in a terminal).
      """
      try:
          return pexpect.run(self.sh, args=["-c", cmd]).replace(
              "\r\n", "\n"
          )
      except KeyboardInterrupt:
          print("^C", file=sys.stderr, end="")
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/_process_posix.py
imports: from __future__ import print_function
  import errno
  import os
  import subprocess
  import sys
  import pexpect
  from ._process_common import getoutput, arg_split
  from IPython.utils import py3compat
  from IPython.utils.encoding import DEFAULT_ENCODING
label_desc: Use image node_id 4 for calling the ProcessHandler obj's underlying member method code with example usage: obj.getoutput_pexpect(cmd) and returns: pexpect