def _run_command(self, env):
output = "<STR_LIT>"<EOL>urgent = False<EOL>for command in self.commands:<EOL><INDENT>try:<EOL><INDENT>process = Popen(<EOL>command,<EOL>stdout=PIPE,<EOL>stderr=PIPE,<EOL>universal_newlines=True,<EOL>env=env,<EOL>shell=True,<EOL>)<EOL><DEDENT>except Exception as e:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise Exception(msg.format(cmd=command, error=e))<EOL><DEDENT>_output, _error = process.communicate()<EOL>if self.py3.is_python_2():<EOL><INDENT>_output = _output.decode("<STR_LIT:utf-8>")<EOL>_error = _error.decode("<STR_LIT:utf-8>")<EOL><DEDENT>retcode = process.poll()<EOL>_urgent = retcode == <NUM_LIT><EOL>if retcode and retcode != <NUM_LIT> or _error:<EOL><INDENT>msg = "<STR_LIT>"<EOL>msg = msg.format(cmd=command)<EOL>self.py3.notify_user(msg, rate_limit=None)<EOL>msg = "<STR_LIT>"<EOL>msg = msg.format(cmd=command, error=_error, retcode=retcode)<EOL>if hash(msg) not in self.errors:<EOL><INDENT>self.py3.log(msg, level=self.py3.LOG_ERROR)<EOL>self.errors.append(hash(msg))<EOL><DEDENT>_output = "<STR_LIT>".format(<EOL>self.py3.COLOR_ERROR or self.py3.COLOR_BAD<EOL>)<EOL><DEDENT>if _output:<EOL><INDENT>output = _output<EOL>urgent = _urgent<EOL><DEDENT><DEDENT>return output, urgent<EOL>
Run command(s) and return output and urgency.