mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
![Ben Konyi](/assets/img/avatar_default.png)
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>
35 lines
848 B
Dart
35 lines
848 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.
|
|
|
|
// @dart = 2.9
|
|
|
|
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(),
|
|
],
|
|
);
|
|
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;
|
|
}
|