mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:01:30 +00:00
71c61ea24c
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>
32 lines
837 B
Dart
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;
|
|
}
|