parameters: (cmd, error_msg=None, exit_on_error=True, out_file=None)
return_statement: return success
docstring: Run the given command in the shell returning whether the command
       succeeded. If 'error_msg' is set, log the error message on failure.
       If 'exit_on_error' is True, exit the program on failure.
       If 'out_file' is specified, log all output to that file.
docstring_summary: Run the given command in the shell returning whether the command
       succeeded. If 'error_msg' is set, log the error message on failure.
       If 'exit_on_error' is True, exit the program on failure.
       If 'out_file' is specified, log all output to that file.
docstring_tokens: Run the given command in the shell returning whether the command succeeded . If error_msg is set log the error message on failure . If exit_on_error is True exit the program on failure . If out_file is specified log all output to that file .
function: def exec_cmd(cmd, error_msg=None, exit_on_error=True, out_file=None):
    """Run the given command in the shell returning whether the command
       succeeded. If 'error_msg' is set, log the error message on failure.
       If 'exit_on_error' is True, exit the program on failure.
       If 'out_file' is specified, log all output to that file."""
    success = True
    if out_file:
      with open(out_file, 'w') as f:
        ret_val = subprocess.call(cmd, shell=True, stderr=f, stdout=f)
    else:
      ret_val = subprocess.call(cmd, shell=True)
    if ret_val != 0:
      if error_msg: LOG.info(error_msg)
      if exit_on_error: sys.exit(ret_val)
      success = False
    return success
function_tokens: def exec_cmd ( cmd , error_msg = None , exit_on_error = True , out_file = None ) : success = True if out_file : with open ( out_file , 'w' ) as f : ret_val = subprocess . call ( cmd , shell = True , stderr = f , stdout = f ) else : ret_val = subprocess . call ( cmd , shell = True ) if ret_val != 0 : if error_msg : LOG . info ( error_msg ) if exit_on_error : sys . exit ( ret_val ) success = False return success