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

Side by Side Diff: runtime/bin/vmservice/vmservice_io.dart

Issue 343433004: Wrap signal listening with try catch to fix Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 vmservice_io; 5 library vmservice_io;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 26 matching lines...) Expand all
37 serverFuture = server.shutdown(true).then((_) { 37 serverFuture = server.shutdown(true).then((_) {
38 serverFuture = null; 38 serverFuture = null;
39 }); 39 });
40 } else { 40 } else {
41 serverFuture = server.startup().then((_) { 41 serverFuture = server.startup().then((_) {
42 serverFuture = null; 42 serverFuture = null;
43 }); 43 });
44 } 44 }
45 } 45 }
46 46
47 main() { 47 void registerSignalHandler() {
48 // Get VMService.
49 service = new VMService();
50 // Start HTTP server.
51 server = new Server(service, _ip, _port);
52 if (_autoStart) {
53 server.startup();
54 }
55
56 bool useSIGQUIT = true; 48 bool useSIGQUIT = true;
57 // Listen for SIGQUIT. 49 // Listen for SIGQUIT.
58 if (useSIGQUIT) { 50 if (useSIGQUIT) {
59 var io = currentMirrorSystem().findLibrary(const Symbol('dart.io')); 51 var io = currentMirrorSystem().findLibrary(const Symbol('dart.io'));
60 var c = MirrorSystem.getSymbol('_ProcessUtils', io); 52 var c = MirrorSystem.getSymbol('_ProcessUtils', io);
61 var m = MirrorSystem.getSymbol('_watchSignalInternal', io); 53 var m = MirrorSystem.getSymbol('_watchSignalInternal', io);
62 var processUtils = io.declarations[c]; 54 var processUtils = io.declarations[c];
63 processUtils.invoke(m, [ProcessSignal.SIGQUIT]).reflectee.listen(_onSignal); 55 processUtils.invoke(m, [ProcessSignal.SIGQUIT]).reflectee.listen(_onSignal);
64 } else { 56 } else {
65 ProcessSignal.SIGUSR1.watch().listen(_onSignal); 57 ProcessSignal.SIGUSR1.watch().listen(_onSignal);
66 } 58 }
67 } 59 }
68 60
61
62 main() {
63 // Get VMService.
64 service = new VMService();
65 // Start HTTP server.
66 server = new Server(service, _ip, _port);
67 if (_autoStart) {
68 server.startup();
69 }
70
71 try {
72 registerSignalHandler();
73 } catch (_) {
74 // Listening for signals will fail on Windows.
75 }
76 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698