dart-sdk/tests/standalone/regress_42092_test.dart
Ben Konyi 71c61ea24c [ VM ] Add delay between SIGINTs to fix flakiness of regress_42092_test
Change-Id: I1cce3f37491567bd13c9f64d4d15afed23a35a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204901
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-06-29 01:36:32 +00:00

32 lines
837 B
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:expect/expect.dart';
Future<void> main() async {
final process = await Process.start(
Platform.resolvedExecutable,
[
Platform.script.resolve('regress_42092_script.dart').toString(),
],
);
late StreamSubscription sub;
int count = 0;
sub = process.stdout.transform(Utf8Decoder()).listen((event) {
print(event);
if (event.contains('child: Got a SIGINT')) {
++count;
if (count == 3) {
sub.cancel();
}
}
process.kill(ProcessSignal.sigint);
});
await process.exitCode;
}