def command_run(self, command):
<EOL>if isinstance(command, basestring):<EOL><INDENT>command = shlex.split(command)<EOL><DEDENT>try:<EOL><INDENT>return Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True).wait()<EOL><DEDENT>except Exception as e:<EOL><INDENT>if isinstance(command, basestring):<EOL><INDENT>pretty_cmd = command<EOL><DEDENT>else:<EOL><INDENT>pretty_cmd = "<STR_LIT:U+0020>".join(command)<EOL><DEDENT>msg = "<STR_LIT>".format(cmd=pretty_cmd, error=e.errno)<EOL>raise exceptions.CommandError(msg, error_code=e.errno)<EOL><DEDENT>
Runs a command and returns the exit code.
The command can either be supplied as a sequence or string.

An Exception is raised if an error occurs