args.add(getURI().getHost());
args.add(command);
- ProcessBuilder pb = new ProcessBuilder();
- pb.command(args);
-
- File directory = local.getDirectory();
- if (directory != null)
- pb.environment().put(Constants.GIT_DIR_KEY,
- directory.getPath());
-
+ ProcessBuilder pb = createProcess(args);
try {
return pb.start();
} catch (IOException err) {
}
}
+ private ProcessBuilder createProcess(List<String> args) {
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.command(args);
+ File directory = local != null ? local.getDirectory() : null;
+ if (directory != null) {
+ pb.environment().put(Constants.GIT_DIR_KEY,
+ directory.getPath());
+ }
+ return pb;
+ }
+
@Override
public void disconnect() {
// Nothing to do