| Index: runtime/lib/isolate_patch.dart
|
| diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
|
| index 3792a5b4d2ddbdee1d72446d80c67cae5cd82062..7d185beb17b9c3c9ef317d235d68cde73cb59718 100644
|
| --- a/runtime/lib/isolate_patch.dart
|
| +++ b/runtime/lib/isolate_patch.dart
|
| @@ -229,40 +229,39 @@ void _startIsolate(Function entryPoint, bool isSpawnUri) {
|
| patch class Isolate {
|
| /* patch */ static Future<Isolate> spawn(
|
| void entryPoint(message), var message) {
|
| - Completer completer = new Completer<Isolate>.sync();
|
| try {
|
| // The VM will invoke [_startIsolate] with entryPoint as argument.
|
| SendPort controlPort = _spawnFunction(entryPoint);
|
| RawReceivePort readyPort = new RawReceivePort();
|
| controlPort.send([readyPort.sendPort, message]);
|
| + Completer completer = new Completer<Isolate>.sync();
|
| readyPort.handler = (readyMessage) {
|
| assert(readyMessage == 'started');
|
| readyPort.close();
|
| completer.complete(new Isolate._fromControlPort(controlPort));
|
| };
|
| - } catch(e, st) {
|
| - // TODO(14718): we want errors to go into the returned future.
|
| - rethrow;
|
| + return completer.future;
|
| + } catch (e, st) {
|
| + return new Future<Isolate>.error(e, st);
|
| };
|
| - return completer.future;
|
| }
|
|
|
| /* patch */ static Future<Isolate> spawnUri(
|
| Uri uri, List<String> args, var message) {
|
| - Completer completer = new Completer<Isolate>.sync();
|
| try {
|
| // The VM will invoke [_startIsolate] and not `main`.
|
| SendPort controlPort = _spawnUri(uri.toString());
|
| RawReceivePort readyPort = new RawReceivePort();
|
| controlPort.send([readyPort.sendPort, args, message]);
|
| + Completer completer = new Completer<Isolate>.sync();
|
| readyPort.handler = (readyMessage) {
|
| assert(readyMessage == 'started');
|
| readyPort.close();
|
| completer.complete(new Isolate._fromControlPort(controlPort));
|
| };
|
| - } catch(e, st) {
|
| - // TODO(14718): we want errors to go into the returned future.
|
| - rethrow;
|
| + return completer.future;
|
| + } catch (e, st) {
|
| + return new Future<Isolate>.error(e, st);
|
| };
|
| return completer.future;
|
| }
|
|
|