- // Env variables
- Map<String, String> environmentVariablesToUse = environmentVariables
- .size() > 0 ? environmentVariables : null;
+ executor.setProcessDestroyer(new ShutdownHookProcessDestroyer());
+ executor.setWorkingDirectory(dir);
+
+ // Command line to use
+ final CommandLine commandLine = createCommandLine();
+ if (logCommand)
+ log.info("Execute command:\n" + commandLine
+ + "\n in working directory: \n" + dir + "\n");
+
+ // Env variables
+ Map<String, String> environmentVariablesToUse = null;
+ if (environmentVariables.size() > 0) {
+ environmentVariablesToUse = new HashMap<String, String>();
+ if (mergeEnvironmentVariables)
+ environmentVariablesToUse.putAll(System.getenv());
+ environmentVariablesToUse.putAll(environmentVariables);
+ }