public void execute() {

        Process proc = null;
        ProcessBuilder pb = new ProcessBuilder(getCommand());

        if (StringUtils.isNotBlank(getWorkingDirectory())) {
            pb.directory(new File(getWorkingDirectory()));
        }

        addLogMessage("Executing command: " + StringUtils.join(getCommand(), " "));
        try {
            proc = pb.start();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        //proc = getCommand().execute();

        InputStream is = proc.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        final BufferedReader br = new BufferedReader(isr);
        new Thread() {
            public void run() {
                String line;
                try {
                    while ((line = br.readLine()) != null) {
                        addMessage(line);
                    }
                } catch (IOException e) {
                    myLogger.debug(e.getLocalizedMessage());
                }
            }
        }.start();
        InputStream es = proc.getErrorStream();
        InputStreamReader esr = new InputStreamReader(es);
        final BufferedReader ebr = new BufferedReader(esr);
        new Thread() {
            public void run() {
                String line;
                try {
                    while ((line = ebr.readLine()) != null) {
                        addErrorMessage(line);
                    }
                } catch (IOException e) {
                    myLogger.debug(e.getLocalizedMessage());
                }
            }
        }.start();

        try {
            proc.waitFor();

            // wait in case stdout/err buffers are not empty yet
            Thread.sleep(500);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        String cmd = StringUtils.join(getCommand(), " ");

        if ( proc.exitValue() == 0 ) {
            addLogMessage("Command " + cmd + " finished");
        } else {
            addLogMessage("Command " + cmd + " failed");
            setFailed();
        }
    }