Source:
<code><START> protected Process start(boolean logProcessOutput) throws IOException { <END> List<String> startCommand = new ArrayList<>(); startCommand.add(getJavaExecutable().getPath()); startCommand.addAll(getJavaOptsProperty(Function.identity())); startCommand.add("-cp"); startCommand.add(getClassPath()); startCommand.addAll(getNuxeoProperties()); startCommand.addAll(getServerProperties()); if (strict) { startCommand.add("-Dnuxeo.start.strict=true"); } startCommand.add(TomcatConfigurator.STARTUP_CLASS); startCommand.add("start"); startCommand.addAll(Arrays.asList(params)); ProcessBuilder pb = new ProcessBuilder(getOSCommand(startCommand)); pb.directory(configurationGenerator.getNuxeoHome()); if (logProcessOutput) { pb.redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT); } log.debug("Server command: {}", pb::command); Process nuxeoProcess = pb.start(); nuxeoProcess.onExit().thenAccept(p -> { if (SystemUtils.IS_OS_WINDOWS && configurationGenerator.getNuxeoHome().getPath().contains(" ")) { log.error("The server path must not contain spaces under Windows."); } int exitValue = p.exitValue(); if (exitValue != 0) { log.error("Server stopped with status: {}", exitValue); } }); String pid; try { pid = String.valueOf(nuxeoProcess.pid()); } catch (UnsupportedOperationException e) { log.warn("Unable to get process ID from process: {}, please report it to Nuxeo", nuxeoProcess); pid = processManager.findPid().orElse(null); } if (pid == null) { log.warn("Sent server start command but could not get process ID."); } else { log.warn("Server started with process ID {}.", pid); File pidFile = new File(configurationGenerator.getPidDir(), "nuxeo.pid"); try (FileWriter writer = new FileWriter(pidFile)) { writer.write(pid); } } return nuxeoProcess; }</code><technical_language>reordering of start / waitForEffectiveStart methods diff hard read</technical_language>

Target:
protected Process start(boolean logProcessOutput) throws IOException { List<String> startCommand = new ArrayList<>(); startCommand.add(getJavaExecutable().getPath()); startCommand.addAll(getJavaOptsProperty(Function.identity())); startCommand.add("-cp"); startCommand.add(getClassPath()); startCommand.addAll(getNuxeoProperties()); startCommand.addAll(getServerProperties()); if (strict) { startCommand.add("-Dnuxeo.start.strict=true"); } startCommand.add(TomcatConfigurator.STARTUP_CLASS); startCommand.add("start"); startCommand.addAll(Arrays.asList(params)); ProcessBuilder pb = new ProcessBuilder(getOSCommand(startCommand)); pb.directory(configurationGenerator.getNuxeoHome()); if (logProcessOutput) { pb.redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT); } log.debug("Server command: {}", pb::command); Process nuxeoProcess = pb.start(); nuxeoProcess.onExit().thenAccept(p -> { if (SystemUtils.IS_OS_WINDOWS && configurationGenerator.getNuxeoHome().getPath().contains(" ")) { log.error("The server path must not contain spaces under Windows."); } int exitValue = p.exitValue(); if (exitValue != 0) { log.error("Server stopped with status: {}", exitValue); } }); Long pid; try { pid = nuxeoProcess.pid(); } catch (UnsupportedOperationException e) { log.warn("Unable to get process ID from process: {}, please report it to Nuxeo", nuxeoProcess); pid = processManager.findPid() .orElseThrow(() -> new NuxeoLauncherException( "Sent server start command but could not get process ID.", EXIT_CODE_ERROR, e)); } log.info("Server started with process ID: {}", pid); File pidFile = new File(configurationGenerator.getPidDir(), "nuxeo.pid"); try (FileWriter writer = new FileWriter(pidFile)) { writer.write(Long.toString(pid)); } return nuxeoProcess; }