Fix dotnet-dump analyze <dump-path> -c exit (#924)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Wed, 18 Mar 2020 20:45:22 +0000 (16:45 -0400)
committerGitHub <noreply@github.com>
Wed, 18 Mar 2020 20:45:22 +0000 (16:45 -0400)
* Fix dotnet-dump analyze <dump-path> -c exit

The exit command would fail to exit the analyze process when
executed from the command line.

* Move fix to ConsoleProvider per feedback, simplify

src/Microsoft.Diagnostics.Repl/Console/ConsoleProvider.cs
src/Tools/dotnet-dump/Analyzer.cs

index 2083ec063c12035164414ffbf7027cd76e1413fb..d59f743369640965f232632410719319104e2d1a 100644 (file)
@@ -50,6 +50,7 @@ namespace Microsoft.Diagnostics.Repl
         {
             m_history = new List<StringBuilder>();
             m_activeLine = new StringBuilder();
+            m_shutdown = false;
 
             m_consoleConverter = new CharToLineConverter(text => {
                 NewOutput(text);
@@ -77,7 +78,6 @@ namespace Microsoft.Diagnostics.Repl
         public async Task Start(Func<string, CancellationToken, Task> dispatchCommand)
         {
             m_lastCommandLine = null;
-            m_shutdown = false;
             m_interactiveConsole = !Console.IsInputRedirected;
             RefreshLine();
 
@@ -115,6 +115,8 @@ namespace Microsoft.Diagnostics.Repl
             }
         }
 
+        public bool Shutdown { get { return m_shutdown; } }
+
         /// <summary>
         /// Stop input processing/dispatching
         /// </summary>
index 500cfb965b4eb7bbca1f178254afa9ac719e0593..d630392ad4bd59388adca4c3d929de9853d96069 100644 (file)
@@ -100,6 +100,9 @@ namespace Microsoft.Diagnostics.Tools.Dump
                         foreach (string cmd in command)
                         {
                             await _commandProcessor.Parse(cmd);
+
+                            if (_consoleProvider.Shutdown)
+                                break;
                         }
                     }