mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Work around for dart-lang/sdk#28603 (#7805)
This commit is contained in:
parent
83514d67c4
commit
829976d35e
@ -12,6 +12,7 @@ import 'application_package.dart';
|
||||
|
||||
import 'base/file_system.dart';
|
||||
import 'base/io.dart';
|
||||
import 'base/os.dart';
|
||||
|
||||
import 'asset.dart';
|
||||
|
||||
@ -111,24 +112,21 @@ abstract class ResidentRunner {
|
||||
|
||||
void registerSignalHandlers() {
|
||||
assert(stayResident);
|
||||
ProcessSignal.SIGINT.watch().listen((ProcessSignal signal) async {
|
||||
_resetTerminal();
|
||||
await cleanupAfterSignal();
|
||||
exit(0);
|
||||
});
|
||||
ProcessSignal.SIGTERM.watch().listen((ProcessSignal signal) async {
|
||||
_resetTerminal();
|
||||
await cleanupAfterSignal();
|
||||
exit(0);
|
||||
});
|
||||
if (!supportsServiceProtocol)
|
||||
return;
|
||||
if (!supportsRestart)
|
||||
ProcessSignal.SIGINT.watch().listen(_cleanUpAndExit);
|
||||
if (!os.isWindows) // TODO(goderbauer): enable on Windows when https://github.com/dart-lang/sdk/issues/28603 is fixed
|
||||
ProcessSignal.SIGTERM.watch().listen(_cleanUpAndExit);
|
||||
if (!supportsServiceProtocol || !supportsRestart)
|
||||
return;
|
||||
ProcessSignal.SIGUSR1.watch().listen(_handleSignal);
|
||||
ProcessSignal.SIGUSR2.watch().listen(_handleSignal);
|
||||
}
|
||||
|
||||
Future<Null> _cleanUpAndExit(ProcessSignal signal) async {
|
||||
_resetTerminal();
|
||||
await cleanupAfterSignal();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
bool _processingSignal = false;
|
||||
Future<Null> _handleSignal(ProcessSignal signal) async {
|
||||
if (_processingSignal) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user