def METHOD_NAME(command, cwd=None, env=None):
    p = subprocess.Popen(command, cwd=cwd,
                         stdin=subprocess.PIPE,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         env=env, close_fds=kUseCloseFDs)
    out,err = p.communicate()
    exitCode = p.wait()
    # Detect Ctrl-C in subprocess.
    if exitCode == -signal.SIGINT:
        raise KeyboardInterrupt
    # Ensure the resulting output is always of string type.
    out = convert_string(out)
    err = convert_string(err)
    return out, err, exitCode