def exec_command(attr, cmd):
import subprocess<EOL>p = popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)<EOL>out, err = p.communicate()<EOL>if p.returncode:<EOL><INDENT>from rez.exceptions import InvalidPackageError<EOL>raise InvalidPackageError(<EOL>"<STR_LIT>" % (attr, err))<EOL><DEDENT>return out.strip(), err.strip()<EOL>
Runs a subproc to calculate a package attribute.