@open_only<EOL><INDENT>def exec_command(self, command):<DEDENT>
m = Message()<EOL>m.add_byte(cMSG_CHANNEL_REQUEST)<EOL>m.add_int(self.remote_chanid)<EOL>m.add_string("<STR_LIT>")<EOL>m.add_boolean(True)<EOL>m.add_string(command)<EOL>self._event_pending()<EOL>self.transport._send_user_message(m)<EOL>self._wait_for_event()<EOL>
Execute a command on the server.  If the server allows it, the channel
will then be directly connected to the stdin, stdout, and stderr of
the command being executed.

When the command finishes executing, the channel will be closed and
can't be reused.  You must open a new channel if you wish to execute
another command.

:param str command: a shell command to execute.

:raises:
    `.SSHException` -- if the request was rejected or the channel was
    closed