OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Library used by debugger wire protocol tests (standalone VM debugging). | 5 // Library used by debugger wire protocol tests (standalone VM debugging). |
6 | 6 |
7 library DartDebugger; | 7 library DartDebugger; |
8 | 8 |
9 import "dart:async"; | 9 import "dart:async"; |
10 import "dart:convert"; | 10 import "dart:convert"; |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 if (socket != null) { | 653 if (socket != null) { |
654 socket.close().catchError((error) { | 654 socket.close().catchError((error) { |
655 // Print this directly in addition to adding it to the | 655 // Print this directly in addition to adding it to the |
656 // error message queue, in case the error message queue | 656 // error message queue, in case the error message queue |
657 // gets printed before this error handler is called. | 657 // gets printed before this error handler is called. |
658 print("Error occurred while closing socket: $error"); | 658 print("Error occurred while closing socket: $error"); |
659 error("Error while closing socket: $error"); | 659 error("Error while closing socket: $error"); |
660 }); | 660 }); |
661 } | 661 } |
662 var targetPid = targetProcess.pid; | 662 var targetPid = targetProcess.pid; |
663 print("Sending kill signal to process $targetPid..."); | 663 if (errorsDetected || !shutdownEventSeen) { |
664 targetProcess.kill(); | 664 print("Sending kill signal to process $targetPid..."); |
665 // If the process was already dead exitCode is already | 665 targetProcess.kill(); |
| 666 } |
| 667 // If the process was already dead, exitCode is |
666 // available and we call exit() in the next event loop cycle. | 668 // available and we call exit() in the next event loop cycle. |
667 // Otherwise this will wait for the process to exit. | 669 // Otherwise this will wait for the process to exit. |
668 targetProcess.exitCode.then((exitCode) { | 670 targetProcess.exitCode.then((exitCode) { |
669 print("process $targetPid terminated with exit code $exitCode."); | 671 print("process $targetPid terminated with exit code $exitCode."); |
| 672 if (exitCode != 0) { |
| 673 error("Error: target process died with exit code $exitCode"); |
| 674 } |
670 if (errorsDetected) { | 675 if (errorsDetected) { |
671 print("\n===== Errors detected: ====="); | 676 print("\n===== Errors detected: ====="); |
672 for (int i = 0; i < errors.length; i++) print(errors[i]); | 677 for (int i = 0; i < errors.length; i++) print(errors[i]); |
673 print("============================\n"); | 678 print("============================\n"); |
674 } | 679 } |
675 exit(errors.length); | 680 exit(errors.length); |
676 }); | 681 }); |
677 cleanupDone = true; | 682 cleanupDone = true; |
678 } | 683 } |
679 } | 684 } |
(...skipping 14 matching lines...) Expand all Loading... |
694 targetOpts.add("--debuggee"); | 699 targetOpts.add("--debuggee"); |
695 print('args: ${targetOpts.join(" ")}'); | 700 print('args: ${targetOpts.join(" ")}'); |
696 | 701 |
697 Process.start(Platform.executable, targetOpts).then((Process process) { | 702 Process.start(Platform.executable, targetOpts).then((Process process) { |
698 print("Debug target process started, pid ${process.pid}."); | 703 print("Debug target process started, pid ${process.pid}."); |
699 process.stdin.close(); | 704 process.stdin.close(); |
700 var debugger = new Debugger(process, new DebugScript(script)); | 705 var debugger = new Debugger(process, new DebugScript(script)); |
701 }); | 706 }); |
702 return true; | 707 return true; |
703 } | 708 } |
OLD | NEW |