2020-07-06 03:02:00 +00:00
|
|
|
// 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 {
|
2021-06-29 01:36:32 +00:00
|
|
|
final process = await Process.start(
|
2020-07-06 03:02:00 +00:00
|
|
|
Platform.resolvedExecutable,
|
|
|
|
[
|
|
|
|
Platform.script.resolve('regress_42092_script.dart').toString(),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
late StreamSubscription sub;
|
2021-06-29 01:36:32 +00:00
|
|
|
int count = 0;
|
2020-07-06 03:02:00 +00:00
|
|
|
sub = process.stdout.transform(Utf8Decoder()).listen((event) {
|
2021-06-29 01:36:32 +00:00
|
|
|
print(event);
|
|
|
|
if (event.contains('child: Got a SIGINT')) {
|
|
|
|
++count;
|
|
|
|
if (count == 3) {
|
|
|
|
sub.cancel();
|
|
|
|
}
|
2020-07-06 03:02:00 +00:00
|
|
|
}
|
2021-06-29 01:36:32 +00:00
|
|
|
process.kill(ProcessSignal.sigint);
|
2020-07-06 03:02:00 +00:00
|
|
|
});
|
|
|
|
|
2021-06-29 01:36:32 +00:00
|
|
|
await process.exitCode;
|
2020-07-06 03:02:00 +00:00
|
|
|
}
|