Fix NPE in TransportGitSsh.ExtSession.exec()
Bug: 527383 Change-Id: I965860b4e0e9aa1adf6a1bb0735940cbd22adced Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
809b9f8d5c
commit
29c5f49f63
|
@ -242,14 +242,7 @@ public Process exec(String command, int timeout)
|
|||
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) {
|
||||
|
@ -257,6 +250,17 @@ public Process exec(String command, int timeout)
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue