[package:testing] Reset the isolates errors fatal option
This code
```
import 'dart:isolate';
Future<void> main([List<String> arguments = const []]) async {
await something();
print("After the call!");
if (1+1==2) throw "This will be swallowed";
print("This will never be printed.");
}
Future<void> something() async {
Isolate.current.setErrorsFatal(false);
}
```
prints
```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/hmm.dart
After the call!
$ echo $?
0
```
I.e. it dies silently, swallowing the throw and has a 0 exit code.
Using package:testing (and having it run at least one thing), it
previously did this so that if anything crashed, say, in user code
after the run (or maybe even some places inside package:testing?) it
would just swallow the error and leave a 0 exit code.
This CL sets the errors fatal thing to true (which must be the default)
causing the normal behaviour of it not swallowing any throws.
Change-Id: I9850bbf504e172cc4077e5e17265833ef58dfe90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350321
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
Commit Queue
parent
502e8e0960
commit
f3740c96e8
@@ -51,6 +51,7 @@ Future runGuarded(
|
||||
|
||||
ReceivePort errorPort = ReceivePort();
|
||||
Future errorFuture = errorPort.listen((errors) {
|
||||
Isolate.current.setErrorsFatal(true);
|
||||
Isolate.current.removeErrorListener(errorPort.sendPort);
|
||||
errorPort.close();
|
||||
var error = (errors as List)[0];
|
||||
@@ -72,6 +73,7 @@ Future runGuarded(
|
||||
|
||||
return completer.future.whenComplete(() {
|
||||
errorPort.close();
|
||||
Isolate.current.setErrorsFatal(true);
|
||||
Isolate.current.removeErrorListener(errorPort.sendPort);
|
||||
return acknowledgeControlMessages(Isolate.current)
|
||||
.then((_) => errorFuture);
|
||||
|
||||
Reference in New Issue
Block a user