def _execute(params, cwd):
proc = subprocess.Popen(<EOL>params,<EOL>stdout=subprocess.PIPE,<EOL>stderr=subprocess.PIPE,<EOL>cwd=cwd<EOL>)<EOL>stdout, stderr = proc.communicate()<EOL>code = proc.wait()<EOL>if code != <NUM_LIT:0>:<EOL><INDENT>e = OSError('<STR_LIT>' % (params, code, stderr))<EOL>e.stdout = stdout<EOL>e.stderr = stderr<EOL>raise e<EOL><DEDENT>return (stdout, stderr)<EOL>
Executes a subprocess

:param params:
    A list of the executable and arguments to pass to it

:param cwd:
    The working directory to execute the command in

:return:
    A 2-element tuple of (stdout, stderr)