src/main/java/org/apache/mesos/hdfs/executor/AbstractNodeExecutor.java
/**
   * Run a command and wait for it's successful completion.
   **/
Run a command and wait for it's successful completion.
Run a command and wait for it ' s successful completion .
protected void runCommand(ExecutorDriver driver, Task task, String command) {
    reloadConfig();
    try {
      log.info(String.format("About to run command: %s", command));
      ProcessBuilder processBuilder = new ProcessBuilder("sh", "-c", command);
      Process init = processBuilder.start();
      redirectProcess(init);
      int exitCode = init.waitFor();
      if (exitCode == 0) {
        log.info("Finished running command, exited with status " + exitCode);
      } else {
        log.error("Unable to run command: " + command);
        if (task.process != null) {
          task.process.destroy();
        }
        sendTaskFailed(driver, task);
      }
    } catch (InterruptedException | IOException e) {
      log.error(e);
      if (task.process != null) {
        task.process.destroy();
      }
      sendTaskFailed(driver, task);
    }
  }
protected void runCommand ( ExecutorDriver driver , Task task , String command ) { reloadConfig ( ) ; try { log . info ( String . format ( "About to run command: %s" , command ) ) ; ProcessBuilder processBuilder = new ProcessBuilder ( "sh" , "-c" , command ) ; Process init = processBuilder . start ( ) ; redirectProcess ( init ) ; int exitCode = init . waitFor ( ) ; if ( exitCode == 0 ) { log . info ( "Finished running command, exited with status " + exitCode ) ; } else { log . error ( "Unable to run command: " + command ) ; if ( task . process != null ) { task . process . destroy ( ) ; } sendTaskFailed ( driver , task ) ; } } catch ( InterruptedException | IOException e ) { log . error ( e ) ; if ( task . process != null ) { task . process . destroy ( ) ; } sendTaskFailed ( driver , task ) ; } }
Run a command and wait for it's successful completion.
Run a command and wait for it ' s successful completion .