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

Unified Diff: tools/ddbg_service/lib/commando.dart

Issue 575853002: Add tools/ddbg_service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add test Created 6 years, 3 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
Index: tools/ddbg_service/lib/commando.dart
diff --git a/tools/ddbg/lib/commando.dart b/tools/ddbg_service/lib/commando.dart
similarity index 97%
copy from tools/ddbg/lib/commando.dart
copy to tools/ddbg_service/lib/commando.dart
index f3ff3ea5e888ad76006a5d047364375cf35f2113..5b46b6be1bc86627f9199d58eab338e5e031dc72 100644
--- a/tools/ddbg/lib/commando.dart
+++ b/tools/ddbg_service/lib/commando.dart
@@ -1,13 +1,15 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+library commando;
+
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
-import 'terminfo.dart';
+import 'package:ddbg/terminfo.dart';
typedef List<String> CommandCompleter(List<String> commandParts);
@@ -687,15 +689,23 @@ List<String> _myCompleter(List<String> commandTokens) {
int _helpCount = 0;
Commando cmdo;
+var cmdoSubscription;
void _handleCommand(String rawCommand) {
String command = rawCommand.trim();
cmdo.hide();
if (command == 'quit') {
- cmdo.close().then((_) {
- print('Exiting');
- });
+ var future = cmdoSubscription.cancel();
+ if (future != null) {
+ future.then((_) {
+ print('Exiting');
+ exit(0);
+ });
+ } else {
+ print('Exiting');
+ exit(0);
+ }
} else if (command == 'help') {
switch (_helpCount) {
case 0:
@@ -727,5 +737,5 @@ void _handleCommand(String rawCommand) {
void main() {
print('[Commando demo]');
cmdo = new Commando(completer:_myCompleter);
- cmdo.commands.listen(_handleCommand);
+ cmdoSubscription = cmdo.commands.listen(_handleCommand);
}

Powered by Google App Engine
This is Rietveld 408576698