public ProcessWrapper createProcess(String[] commandLine, String commandLineForDisplay, File workingDir, Map<String, String> envMap, EnvironmentVariableContext environmentVariableContext, ConsoleOutputStreamConsumer consumer, String processTag, String encoding, String errorPrefix) { ProcessBuilder processBuilder = new ProcessBuilder(commandLine); LOG.debug("Executing: {}", commandLineForDisplay); if (workingDir != null) { LOG.debug("[Command Line] Using working directory {} to start the process.", workingDir.getAbsolutePath()); processBuilder.directory(workingDir); } processBuilder.environment().putAll(environmentVariableContext.getProperties()); processBuilder.environment().putAll(envMap); Process process = startProcess(processBuilder, commandLineForDisplay); ProcessWrapper processWrapper = new ProcessWrapper(process, processTag, commandLineForDisplay, consumer, encoding, errorPrefix); processMap.putIfAbsent(process, processWrapper); return processWrapper; }