Unverified Commit 95889463 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Do not continue a hot restart if _restartFromSources fails (#22645)

parent a6c5ec2e
......@@ -502,7 +502,9 @@ class HotRunner extends ResidentRunner {
try {
if (!(await hotRunnerConfig.setupHotRestart()))
return OperationResult(1, 'setupHotRestart failed');
await _restartFromSources();
final OperationResult result = await _restartFromSources();
if (!result.isOk)
return result;
} finally {
status.cancel();
}
......
......@@ -103,14 +103,16 @@ void main() {
testUsingContext('no setup', () async {
final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)];
expect((await HotRunner(devices).restart(fullRestart: true)).isOk, true);
expect((await HotRunner(devices).restart(fullRestart: true)).isOk, false);
}, overrides: <Type, Generator>{
Artifacts: () => mockArtifacts,
});
testUsingContext('setup function succeeds', () async {
final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)];
expect((await HotRunner(devices).restart(fullRestart: true)).isOk, true);
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
expect(result.isOk, false);
expect(result.message, isNot('setupHotRestart failed'));
}, overrides: <Type, Generator>{
Artifacts: () => mockArtifacts,
HotRunnerConfig: () => TestHotRunnerConfig(successfulSetup: true),
......@@ -118,7 +120,9 @@ void main() {
testUsingContext('setup function fails', () async {
final List<FlutterDevice> devices = <FlutterDevice>[FlutterDevice(MockDevice(), generator: residentCompiler, trackWidgetCreation: false)];
expect((await HotRunner(devices).restart(fullRestart: true)).isOk, false);
final OperationResult result = await HotRunner(devices).restart(fullRestart: true);
expect(result.isOk, false);
expect(result.message, 'setupHotRestart failed');
}, overrides: <Type, Generator>{
Artifacts: () => mockArtifacts,
HotRunnerConfig: () => TestHotRunnerConfig(successfulSetup: false),
......
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