Index: runtime/bin/vmservice/vmservice_io.dart |
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart |
index c04d485dbf27a20b724cdf7187ad3f6d4f45f5f9..2d99e17eb85787fab4fe322e4732688083870545 100644 |
--- a/runtime/bin/vmservice/vmservice_io.dart |
+++ b/runtime/bin/vmservice/vmservice_io.dart |
@@ -10,6 +10,7 @@ import 'dart:io'; |
import 'dart:isolate'; |
import 'dart:vmservice'; |
+part 'loader.dart'; |
part 'resources.dart'; |
part 'server.dart'; |
@@ -21,6 +22,8 @@ bool _autoStart; |
bool _isWindows = false; |
+var _signalWatch; |
+ |
// HTTP servr. |
Server server; |
Future<Server> serverFuture; |
@@ -54,18 +57,27 @@ void _onSignal(ProcessSignal signal) { |
} |
} |
-void _registerSignalHandler(Stream signalWatch(ProcessSignal signal)) { |
+void _registerSignalHandler() { |
if (_isWindows) { |
// Cannot register for signals on Windows. |
return; |
} |
- signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); |
+ _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal); |
} |
-main(Stream signalWatch(ProcessSignal signal)) { |
+const _shortDelay = const Duration(milliseconds: 10); |
+ |
+main() { |
if (_autoStart) { |
_bootServer(); |
server.startup(); |
+ // It's just here to push an event on the event loop so that we invoke the |
+ // scheduled microtasks. |
+ Timer.run(() {}); |
} |
- _registerSignalHandler(signalWatch); |
+ scriptLoadPort.handler = _processLoadRequest; |
+ // Register signal handler after a small delay to avoid stalling main |
+ // isolate startup. |
+ new Timer(_shortDelay, _registerSignalHandler); |
+ return scriptLoadPort; |
} |