public Process exec(String command, int timeout)throws TransportException {String ssh = SystemReader.getInstance().getenv("GIT_SSH"); boolean putty = ssh.toLowerCase(Locale.ROOT).contains("plink"); List<String> args = new ArrayList<>();args.add(ssh);if (putty&& !ssh.toLowerCase(Locale.ROOT).contains("tortoiseplink")) args.add("-batch"); if (0 < getURI().getPort()) {args.add(putty ? "-P" : "-p"); args.add(String.valueOf(getURI().getPort()));}if (getURI().getUser() != null)args.add(getURI().getUser() + "@" + getURI().getHost()); elseargs.add(getURI().getHost());args.add(command);ProcessBuilder pb = createProcess(args);try {return pb.start();} catch (IOException err) {throw new TransportException(err.getMessage(), err);}}
public virtual SystemProcess Exec(string command, int timeout){string ssh = SystemReader.GetInstance().Getenv("GIT_SSH");bool putty = ssh.ToLower().Contains("plink");IList<string> args = new AList<string>();args.AddItem(ssh);if (putty && !ssh.ToLower().Contains("tortoiseplink")){args.AddItem("-batch");}if (0 < this._enclosing.GetURI().GetPort()){args.AddItem(putty ? "-P" : "-p");args.AddItem(this._enclosing.GetURI().GetPort().ToString());}if (this._enclosing.GetURI().GetUser() != null){args.AddItem(this._enclosing.GetURI().GetUser() + "@" + this._enclosing.GetURI().GetHost());}else{args.AddItem(this._enclosing.GetURI().GetHost());}args.AddItem(command);ProcessStartInfo pb = new ProcessStartInfo();pb.SetCommand(args);if (this._enclosing.local.Directory != null){pb.EnvironmentVariables.Put(Constants.GIT_DIR_KEY, this._enclosing.local.Directory.GetPath());}try{return pb.Start();}catch (IOException err){throw new TransportException(err.Message, err);}}