Audit devicelab log streaming for nullability (#84820)

This commit is contained in:
Jenn Magder
2021-06-18 00:14:03 -07:00
committed by GitHub
parent 15301a6f44
commit 03034e9e4a
11 changed files with 66 additions and 74 deletions

View File

@@ -615,10 +615,11 @@ class AndroidDevice extends Device {
@override
Future<void> stopLoggingToSink() async {
assert(_loggingProcess != null);
_abortedLogging = true;
_loggingProcess.kill();
await _loggingProcess.exitCode;
if (_loggingProcess != null) {
_abortedLogging = true;
_loggingProcess.kill();
await _loggingProcess.exitCode;
}
}
@override
@@ -877,10 +878,11 @@ class IosDevice extends Device {
@override
Future<void> stopLoggingToSink() async {
assert(_loggingProcess != null);
_abortedLogging = true;
_loggingProcess.kill();
await _loggingProcess.exitCode;
if (_loggingProcess != null) {
_abortedLogging = true;
_loggingProcess.kill();
await _loggingProcess.exitCode;
}
}
// The methods below are stubs for now. They will need to be expanded.

View File

@@ -161,9 +161,8 @@ class _TaskRunner {
result = await futureResult;
} finally {
if (device != null && device.canStreamLogs) {
assert(sink != null);
await device.stopLoggingToSink();
await sink.close();
await sink?.close();
}
}

View File

@@ -16,6 +16,7 @@ import 'package:path/path.dart' as path;
import 'package:process/process.dart';
import 'package:stack_trace/stack_trace.dart';
import 'host_agent.dart';
import 'task_result.dart';
/// Virtual current working directory, which affect functions, such as [exec].
@@ -453,6 +454,11 @@ List<String> flutterCommandArgs(String command, List<String> options) {
'--device-timeout',
'5',
],
if (command == 'drive' && hostAgent.dumpDirectory != null) ...<String>[
'--screenshot',
hostAgent.dumpDirectory.path,
],
if (localEngine != null) ...<String>['--local-engine', localEngine],
if (localEngineSrcPath != null) ...<String>['--local-engine-src-path', localEngineSrcPath],
...options,