private int start()

in src/main/java/org/apache/maven/plugin/compiler/ForkedTool.java [200:232]


    private int start(ProcessBuilder builder, Appendable out) throws IOException {
        if (debugFilePath != null) {
            // Use the path separator as a way to identify the operating system.
            final boolean windows = File.separatorChar == '\\';
            String filename = debugFilePath.getFileName().toString();
            filename = filename.substring(0, filename.lastIndexOf('.') + 1);
            filename += windows ? "bat" : "sh";
            boolean more = false;
            try (BufferedWriter debugFile = Files.newBufferedWriter(debugFilePath.resolveSibling(filename))) {
                if (basedir != null) {
                    debugFile.write(windows ? "chdir " : "cd ");
                    debugFile.write(basedir.toString());
                    debugFile.newLine();
                }
                for (String cmd : builder.command()) {
                    if (more) {
                        debugFile.append(' ');
                    }
                    debugFile.append(cmd);
                    more = true;
                }
                debugFile.newLine();
            }
        }
        Process process = builder.start();
        try {
            return process.waitFor();
        } catch (InterruptedException e) {
            out.append("Compilation has been interrupted by " + e).append(System.lineSeparator());
            process.destroy();
            return 1;
        }
    }