parameters: (cmd, **kwargs)
return_statement: return output
docstring: run the command cmd, read the results and return them
      this is sorta like `cmd` in shell
  
      :param cmd: command to run with Popen
      :type cmd: string, list
      :returns: command stdout
      :rtype: string
docstring_summary: run the command cmd, read the results and return them
      this is sorta like `cmd` in shell
docstring_tokens: run the command cmd read the results and return them this is sorta like cmd in shell
function: def readCommand(cmd, **kwargs):
      """
      run the command cmd, read the results and return them
      this is sorta like `cmd` in shell
  
      :param cmd: command to run with Popen
      :type cmd: string, list
      :returns: command stdout
      :rtype: string
      """
      from subprocess import Popen, PIPE, STDOUT
  
      if isinstance(cmd, str):
          cmd = cmd.split()
  
      no_exception = 'exception' in kwargs
      exception = kwargs.pop('exception', None)
  
      kwargs.setdefault('shell', False)
      kwargs.setdefault('stdout', PIPE)
      kwargs.setdefault('stderr', STDOUT)
      kwargs.setdefault('close_fds', True)
      try:
          subp = Popen(cmd, **kwargs)
      except Exception as e:
          if no_exception:
              return -1, exception
          raise
  
      output = subp.communicate()[0].decode('utf-8')
      return output
function_tokens: def readCommand ( cmd , * * kwargs ) : from subprocess import Popen , PIPE , STDOUT if isinstance ( cmd , str ) : cmd = cmd . split ( ) no_exception = 'exception' in kwargs exception = kwargs . pop ( 'exception' , None ) kwargs . setdefault ( 'shell' , False ) kwargs . setdefault ( 'stdout' , PIPE ) kwargs . setdefault ( 'stderr' , STDOUT ) kwargs . setdefault ( 'close_fds' , True ) try : subp = Popen ( cmd , * * kwargs ) except Exception as e : if no_exception : return - 1 , exception raise output = subp . communicate ( ) [ 0 ] . decode ( 'utf-8' ) return output