freeProcessResources(p);
    public final static Result executeCommandLineCommandWithEnvVarsInWorkingDir(String command, String[] envp, File dir) throws IOException {        Runtime rt = Runtime.getRuntime();        Process p = null;        StringBuffer response = new StringBuffer();        String input = "";        String error = "";        try {            if (log.isDebugEnabled()) {                log.debug("will execute command "+command);            }            if (dir == null && envp == null) {                p = rt.exec(command);            } else if (dir == null) {                p = rt.exec(command, envp);            } else if (envp == null) {                throw new IllegalArgumentException("if dir != null then envp must also be != null");            } else {                p = rt.exec(command, envp, dir);            }            //wait for the result of identify            try {                p.waitFor();            } catch (InterruptedException ex) {}            byte[] b = new byte[100];            int len = 0;            InputStream is = p.getInputStream();            while ((len = is.read(b)) != -1) {                byte[] res = new byte[len];                System.arraycopy(b, 0, res, 0, len);                String s = new String(res);                response.append(s);            }                    } finally {            InputStream is = p.getInputStream();            if (is!=null) input = ERXFileUtilities.stringFromInputStream(is);            is = p.getErrorStream();            if (is!=null) error = ERXFileUtilities.stringFromInputStream(is);                        if (log.isDebugEnabled()) {                log.debug("input = "+input);                log.debug("error = "+error);            }            freeProcessResources(p);        }        return new Result(response.toString(), input, error);    }