Commit 0550c2f0 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove workaround for SIGINT (#8834)

It's no longer needed with the latest Dart SDK roll.
parent 2bbe82ef
...@@ -58,7 +58,6 @@ import 'src/usage.dart'; ...@@ -58,7 +58,6 @@ import 'src/usage.dart';
/// ///
/// This function is intended to be used from the `flutter` command line tool. /// This function is intended to be used from the `flutter` command line tool.
Future<Null> main(List<String> args) async { Future<Null> main(List<String> args) async {
SigintProcessSignal.instance.init();
final bool verbose = args.contains('-v') || args.contains('--verbose'); final bool verbose = args.contains('-v') || args.contains('--verbose');
final bool help = args.contains('-h') || args.contains('--help') || final bool help = args.contains('-h') || args.contains('--help') ||
(args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose); (args.isNotEmpty && args.first == 'help') || (args.length == 1 && verbose);
......
...@@ -115,8 +115,7 @@ class ProcessSignal implements io.ProcessSignal { ...@@ -115,8 +115,7 @@ class ProcessSignal implements io.ProcessSignal {
static const ProcessSignal SIGTERM = const _PosixProcessSignal._(io.ProcessSignal.SIGTERM); static const ProcessSignal SIGTERM = const _PosixProcessSignal._(io.ProcessSignal.SIGTERM);
static const ProcessSignal SIGUSR1 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR1); static const ProcessSignal SIGUSR1 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR1);
static const ProcessSignal SIGUSR2 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR2); static const ProcessSignal SIGUSR2 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR2);
static const ProcessSignal SIGINT = const ProcessSignal(io.ProcessSignal.SIGINT);
static final ProcessSignal SIGINT = SigintProcessSignal.instance; // ignore: non_constant_identifier_names
final io.ProcessSignal _delegate; final io.ProcessSignal _delegate;
...@@ -143,35 +142,3 @@ class _PosixProcessSignal extends ProcessSignal { ...@@ -143,35 +142,3 @@ class _PosixProcessSignal extends ProcessSignal {
return super.watch(); return super.watch();
} }
} }
// TODO(goderbauer): remove when https://github.com/dart-lang/sdk/issues/28995 is resolved.
class SigintProcessSignal extends ProcessSignal {
SigintProcessSignal._() : super(io.ProcessSignal.SIGINT);
static final SigintProcessSignal instance = new SigintProcessSignal._();
bool _isInitialized = false;
final StreamController<ProcessSignal> _controller = new StreamController<ProcessSignal>();
@override
Stream<ProcessSignal> watch() {
init();
return _controller.stream;
}
void init() {
if (!_isInitialized) {
_delegate.watch().listen(_handleSigInt);
_isInitialized = true;
}
}
void _handleSigInt(io.ProcessSignal signal) {
if (platform.isWindows && !_controller.hasListener) {
// If nobody is listening for SIGINT, we force a clean exit to avoid
// https://github.com/dart-lang/sdk/issues/28995.
exit(0);
}
_controller.add(this);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment