code: public int execute() throws IOException
      {
          Runtime runtime = Runtime.getRuntime();
  
          int exitCode = -1;
          TerminateProcessThread terminateProcess = null;
          Process process = null;
  
          try
          {
              // Execute the command
              String[] command = (String[]) this.command.toArray(new String[this.command.size()]);
  
              if (this.workingDirectory != null)
              {
                  process = runtime.exec(command, null, this.workingDirectory);
              }
              else
              {
                  process = runtime.exec(command);
              }
  
              // Start the stream handler
              this.handler.setErrorStream(process.getErrorStream());
              this.handler.setInputStream(process.getInputStream());
              this.handler.setOutputStream(process.getOutputStream());
  
              this.handler.start();
  
              // Setup the thread to terminate the process if the JVM is shut down
              if (this.terminateOnJvmExit)
              {
                  terminateProcess = new TerminateProcessThread(process);
                  runtime.addShutdownHook(terminateProcess);
              }
  
              exitCode = process.waitFor();
          }
          catch (InterruptedException e)
          {
              process.destroy();
          }
          finally
          {
              // Stop the stream handler
              this.handler.stop();
  
              // Remove the terminate hook
              if (terminateProcess != null)
              {
                  runtime.removeShutdownHook(terminateProcess);
              }
  
              // Close off the streams
              if (process != null)
              {
                  closeStreams(process);
              }
          }
  
          return exitCode;
      }
docs: Executes the process.
  @return The exit code of the process.
  @throws IOException if there was a I/O problem whilst executing the process.