title: C# SSH command execute
body: <p>i need a small help with my app. When I press the button the app freezes until ssh complete the commnand which was sent. I tried solution from <a href="https://stackoverflow.com/questions/30117915/c-sharp-application-freezes">C# application freezes</a> but when I tried to use  <code>Task.Factory.StartNew(()... </code> i dont have a output in console. There is my code:</p>
  <pre><code>var cmd = SSH.CreateCommand(&quot;apt update &amp;&amp; apt upgrade -y&quot;);
                      var asynch = cmd.BeginExecute();
                      var reader = new StreamReader(cmd.OutputStream);
  
                      while (!asynch.IsCompleted)
                      {
                          var result = reader.ReadToEnd();
                          if (string.IsNullOrEmpty(result))
                              continue;
                          Console.Write(result);
                      }
                      cmd.EndExecute(asynch); 
  </code></pre>
  <p>Does anyone have anything to do with it?</p>