Exemple #1
0
  /** Executes the specified command, if the host is connected. */
  void execCommand(final String command) {
    final String hostName = host.getName();

    if (!host.isConnected()) {
      return;
    }
    if (!"".equals(command)) {
      Tools.startProgressIndicator(hostName, "Executing command");
    }
    host.execCommandRaw(
        command,
        new ExecCallback() {
          @Override
          public void done(final String ans) {
            if (!"".equals(command)) {
              Tools.stopProgressIndicator(hostName, "Executing command");
            }
          }

          @Override
          public void doneError(final String ans, final int exitCode) {
            if (!"".equals(command)) {
              Tools.stopProgressIndicator(hostName, "Executing command");
            }
          }
        },
        true,
        false,
        SSH.DEFAULT_COMMAND_TIMEOUT);
  }