Commit 5f57d87a authored by John McCutchan's avatar John McCutchan Committed by GitHub

Disable features of `flutter run` that depend on the service protocol when...

Disable features of `flutter run` that depend on the service protocol when running in release mode (#6571)
parent 4046db98
......@@ -28,6 +28,11 @@ abstract class ResidentRunner {
final bool usesTerminalUI;
final Completer<int> _finished = new Completer<int>();
bool get isRunningDebug => debuggingOptions.buildMode == BuildMode.debug;
bool get isRunningProfile => debuggingOptions.buildMode == BuildMode.profile;
bool get isRunningRelease => debuggingOptions.buildMode == BuildMode.release;
bool get supportsServiceProtocol => isRunningDebug || isRunningProfile;
VMService vmService;
FlutterView currentView;
StreamSubscription<String> _loggingSubscription;
......@@ -72,6 +77,8 @@ abstract class ResidentRunner {
await cleanupAfterSignal();
exit(0);
});
if (!supportsServiceProtocol)
return;
ProcessSignal.SIGUSR1.watch().listen((ProcessSignal signal) async {
printStatus('Caught SIGUSR1');
await restart(fullRestart: false);
......@@ -130,9 +137,13 @@ abstract class ResidentRunner {
printHelp(details: true);
return true;
} else if (lower == 'w') {
if (!supportsServiceProtocol)
return true;
await _debugDumpApp();
return true;
} else if (lower == 't') {
if (!supportsServiceProtocol)
return true;
await _debugDumpRenderTree();
return true;
} else if (lower == 'q' || character == AnsiTerminal.KEY_F10) {
......
......@@ -243,6 +243,8 @@ class RunAndStayResident extends ResidentRunner {
Future<Null> handleTerminalCommand(String code) async {
String lower = code.toLowerCase();
if (lower == 'r' || code == AnsiTerminal.KEY_F5) {
if (!supportsServiceProtocol)
return;
if (device.supportsRestart) {
// F5, restart
await restart();
......@@ -263,13 +265,17 @@ class RunAndStayResident extends ResidentRunner {
@override
void printHelp({ @required bool details }) {
if (!prebuiltMode && device.supportsRestart)
final bool showRestartText = !prebuiltMode && device.supportsRestart &&
supportsServiceProtocol;
if (showRestartText)
printStatus('To restart the app, press "r" or F5.');
if (_result.hasObservatory)
printStatus('The Observatory debugger and profiler is available at: http://127.0.0.1:${_result.observatoryPort}/');
if (details) {
printStatus('To dump the widget hierarchy of the app (debugDumpApp), press "w".');
printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "r".');
if (supportsServiceProtocol) {
printStatus('To dump the widget hierarchy of the app (debugDumpApp), press "w".');
printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "r".');
}
printStatus('To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.');
} else {
printStatus('For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.');
......
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