/// <summary> /// Opens a channel on the session ("sock") for executing the given /// command, opens streams, and starts command execution. /// </summary> /// <remarks> /// Opens a channel on the session ("sock") for executing the given /// command, opens streams, and starts command execution. /// </remarks> /// <param name="commandName">the command to execute</param> /// <param name="tms">the timeout value, in seconds, for the command.</param> /// <exception cref="NGit.Errors.TransportException"> /// on problems opening a channel or connecting to the remote /// host /// </exception> /// <exception cref="System.IO.IOException">on problems opening streams</exception> public JschProcess(JschSession _enclosing, string commandName, int tms) { this._enclosing = _enclosing; this.timeout = tms; try { this.channel = (ChannelExec)this._enclosing.sock.OpenChannel("exec"); this.channel.SetCommand(commandName); this.SetupStreams(); this.channel.Connect(this.timeout > 0 ? this.timeout * 1000 : 0); if (!this.channel.IsConnected()) { throw new TransportException(this._enclosing.uri, "connection failed"); } } catch (JSchException e) { throw new TransportException(this._enclosing.uri, e.Message, e); } }