private void executeScript(String script, File file) throws IOException, InterruptedException {
        if (!StringUtils.isEmpty(script) && !script.equals("no-script")) {
            Path scriptPath = Paths.get(script);
            if (!Files.exists(scriptPath) || !Files.isExecutable(scriptPath)) {
                throw new IOException("Cannot execute configured script at " + scriptPath);
            }
            ProcessBuilder postProcess = new ProcessBuilder();
            postProcess.command(script, file.getAbsolutePath());
            postProcess.directory(new File(script).getParentFile());
            postProcess.redirectErrorStream(true);
            Process processProc = postProcess.start();
            processProc.waitFor();
        }
    }
Executes a script taking the passed file as it's first argument.

@param script the path to the script to execute
@param file   the file to process
@throws IOException          on any IO errors
@throws InterruptedException if the process fails.
tika-translate/src/main/java/org/apache/tika/language/translate/impl/MarianTranslator.java