private void WaitOnHandle(WaitHandle waitHandle)
{
var waitHandles = new[]
{
_sessionErrorOccuredWaitHandle,
waitHandle
};
switch (WaitHandle.WaitAny(waitHandles, CommandTimeout))
{
case 0:
throw _exception;
case WaitHandle.WaitTimeout:
throw new SshOperationTimeoutException(string.Format(CultureInfo.CurrentCulture, "Command '{0}' has timed out.", CommandText));
}
}