docs: def list_vars(script_path, ignore=IGNORE_DEFAULT):
      """
      Given a shell script, returns a list of shell variable names.
      Note: this method executes the script, so beware if it contains side-effects.
      :param script_path: Path the a shell script
      :type script_path: str or unicode
      :param ignore: variable names to ignore.  By default we ignore variables
                      that env injects into the script's environment.
                      See IGNORE_DEFAULT.
      :type ignore: iterable
      :return: Key value pairs representing the environment variables defined
              in the script.
      :rtype: list
      """
      if path.isfile(script_path):
          input = (""". "%s"; env | awk -F = '/[a-zA-Z_][a-zA-Z_0-9]*=/ """ % script_path +
                   """{ if (!system("[ -n \\"${" $1 "}\\" ]")) print $1 }'""")
          cmd = "env -i bash".split()
  
          p = Popen(cmd, stdout=PIPE, stdin=PIPE, stderr=PIPE)
          stdout_data, stderr_data = p.communicate(input=input)
          if stderr_data:
              raise ShellScriptException(script_path, stderr_data)
          else:
              lines = stdout_data.split()
              return [elt for elt in lines if elt not in ignore]
      else:
          raise _noscripterror(script_path)