def run(cmd, **kw):
kw = kw.copy()<EOL>kw.setdefault('<STR_LIT>', False)  <EOL>report_error = kw.pop('<STR_LIT>', True)<EOL>runner = kw.pop('<STR_LIT>', invoke_run)<EOL>try:<EOL><INDENT>return runner(cmd, **kw)<EOL><DEDENT>except exceptions.Failure as exc:<EOL><INDENT>sys.stdout.flush()<EOL>sys.stderr.flush()<EOL>if report_error:<EOL><INDENT>notify.error("<STR_LIT>".format(cmd, exc.result.return_code,))<EOL><DEDENT>raise<EOL><DEDENT>finally:<EOL><INDENT>sys.stdout.flush()<EOL>sys.stderr.flush()<EOL><DEDENT>
Run a command and flush its output.