Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: pkg/dartino_compiler/lib/cli_debugger.dart

Issue 2029723004: Don't quit debugger when the program terminates, only after `quit`. Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dartino_compiler/lib/src/worker/developer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dartino_compiler/lib/cli_debugger.dart
diff --git a/pkg/dartino_compiler/lib/cli_debugger.dart b/pkg/dartino_compiler/lib/cli_debugger.dart
index d8340662e69956b1e925a2f43090020a814e5c72..3be29bc1dbd46c533bb8254bcd414eda59fdc4ec 100644
--- a/pkg/dartino_compiler/lib/cli_debugger.dart
+++ b/pkg/dartino_compiler/lib/cli_debugger.dart
@@ -77,6 +77,7 @@ class CommandLineDebugger {
bool verbose = true;
String previousLine = '';
+ bool quitDebugger = false;
int processPagingCount = 10;
int processPagingCurrent = 0;
@@ -386,6 +387,7 @@ class CommandLineDebugger {
case 'q':
case 'quit':
await vmContext.terminate();
+ quitDebugger = true;
break;
case 'r':
case 'run':
@@ -444,7 +446,6 @@ class CommandLineDebugger {
break;
}
previousLine = line;
- if (!vmContext.terminated) printPrompt();
}
bool toggleVerbose() => verbose = !verbose;
@@ -498,9 +499,14 @@ class CommandLineDebugger {
Future<int> run(SessionState state, {Uri snapshotLocation}) async {
await vmContext.initialize(state, snapshotLocation: snapshotLocation);
writeStdoutLine(BANNER);
- printPrompt();
StreamIterator streamIterator = new StreamIterator(stream);
- while (await streamIterator.moveNext()) {
+
+ Future<bool> getNext() async {
+ printPrompt();
+ return await streamIterator.moveNext();
+ }
+
+ while (!quitDebugger && await getNext()) {
try {
await handleLine(streamIterator);
} catch (e, s) {
@@ -511,11 +517,10 @@ class CommandLineDebugger {
await cancel;
return new Future.error(e, s);
}
- if (vmContext.terminated) {
- await streamIterator.cancel();
- }
}
- if (!vmContext.terminated) await vmContext.terminate();
+ if (!vmContext.terminated) {
+ await vmContext.terminate();
+ }
return vmContext.interactiveExitCode;
}
« no previous file with comments | « no previous file | pkg/dartino_compiler/lib/src/worker/developer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698