using System;
using System.IO;
using System.Text;
using System.Threading;
using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using Renci.SshNet.Messages;
using Renci.SshNet.Messages.Connection;
using Renci.SshNet.Messages.Transport;
using System.Globalization;
namespace Renci.SshNet
{
    /// 
    /// Represents SSH command that can be executed.
    /// 
    public partial class SshCommand : IDisposable
    {
        private readonly ISession _session;
        private readonly Encoding _encoding;
        private IChannelSession _channel;
        private CommandAsyncResult _asyncResult;
        private AsyncCallback _callback;
        private EventWaitHandle _sessionErrorOccuredWaitHandle = new AutoResetEvent(false);
        private Exception _exception;
        private bool _hasError;
        private readonly object _endExecuteLock = new object();
        /// 
        /// Gets the command text.
        /// 
        public string CommandText { get; private set; }
        /// 
        /// Gets or sets the command timeout.
        /// 
        /// 
        /// The command timeout.
        /// 
        /// 
        ///