Skip to content

Commit

Permalink
Fix #5 - correctly pass environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpett committed Feb 13, 2016
1 parent af7c591 commit 5b1e10e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.io.File;
import java.io.InputStream;
import java.util.Map;
import java.util.Scanner;

class XUnitBuildProcess extends FutureBasedBuildProcess {
Expand Down Expand Up @@ -63,7 +64,16 @@ public BuildFinishedStatus call() throws Exception {

String filePath = assembly.getAbsolutePath();
String commandLineFlags = getCommandLineFlags(version);
Process process = new ProcessBuilder(runnerPath, filePath, commandLineFlags).start();
ProcessBuilder processBuilder = new ProcessBuilder(runnerPath, filePath, commandLineFlags);

// Copy environment variables
Map<String, String> env = processBuilder.environment();
for(Map.Entry<String, String> kvp : context.getBuildParameters().getEnvironmentVariables().entrySet()) {
env.put(kvp.getKey(), kvp.getValue());
}

Process process = processBuilder.start();

redirectStreamToLogger(process.getInputStream(), new RedirectionTarget() {
public void redirect(String s) {
logger.message(s);
Expand Down

0 comments on commit 5b1e10e

Please sign in to comment.