private void execute(ClientSession session, String command) throws Exception {
ChannelExec channel = session.createExecChannel(command);
channel.setOut(System.out);
channel.setErr(System.err);
channel.open().verify();
channel.waitFor(ClientChannel.CLOSED, 0);
if (channel.getExitStatus() != null) {
int s = channel.getExitStatus();
if (s != 0) {
throw new Exception("Command failed with status " + s);
}