Unverified Commit b84ac50d authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

[flutter_tool] Misc. fixes for Fuchsia (#33466)

parent c1d448f3
......@@ -23,7 +23,8 @@ class FuchsiaDevFinder {
/// formatted as follows:
/// 192.168.42.172 scare-cable-skip-joy
Future<List<String>> list() async {
if (fuchsiaArtifacts.devFinder == null) {
if (fuchsiaArtifacts.devFinder == null ||
!fuchsiaArtifacts.devFinder.existsSync()) {
throwToolExit('Fuchsia dev_finder tool not found.');
}
final List<String> command = <String>[
......@@ -45,7 +46,8 @@ class FuchsiaDevFinder {
/// The string [deviceName] should be the name of the device from the
/// 'list' command, e.g. 'scare-cable-skip-joy'.
Future<String> resolve(String deviceName) async {
if (fuchsiaArtifacts.devFinder == null) {
if (fuchsiaArtifacts.devFinder == null ||
!fuchsiaArtifacts.devFinder.existsSync()) {
throwToolExit('Fuchsia dev_finder tool not found.');
}
final List<String> command = <String>[
......
......@@ -378,7 +378,7 @@ class FuchsiaDevice extends Device {
const String findCommand = 'find /hub -name vmservice-port';
final RunResult findResult = await shell(findCommand);
if (findResult.exitCode != 0) {
throwToolExit("'$findCommand' on device $id failed");
throwToolExit("'$findCommand' on device $id failed. stderr: '${findResult.stderr}'");
return null;
}
final String findOutput = findResult.stdout;
......
......@@ -46,7 +46,8 @@ class FuchsiaSdk {
/// $ dev_finder list -full
/// > 192.168.42.56 paper-pulp-bush-angel
Future<String> listDevices() async {
if (fuchsiaArtifacts.devFinder == null) {
if (fuchsiaArtifacts.devFinder == null ||
!fuchsiaArtifacts.devFinder.existsSync()) {
return null;
}
final List<String> devices = await fuchsiaDevFinder.list();
......@@ -64,7 +65,8 @@ class FuchsiaSdk {
StreamController<String>(onCancel: () {
process.kill();
});
if (fuchsiaArtifacts.sshConfig == null) {
if (fuchsiaArtifacts.sshConfig == null ||
!fuchsiaArtifacts.sshConfig.existsSync()) {
printError('Cannot read device logs: No ssh config.');
printError('Have you set FUCHSIA_SSH_CONFIG or FUCHSIA_BUILD_DIR?');
return null;
......@@ -91,7 +93,7 @@ class FuchsiaSdk {
} catch (exception) {
printTrace('$exception');
}
return null;
return const Stream<String>.empty();
}
}
......
......@@ -240,6 +240,8 @@ void main() {
when(mockProcess.stderr).thenAnswer((Invocation _) => stderr.stream);
devFinder = MockFile();
sshConfig = MockFile();
when(devFinder.existsSync()).thenReturn(true);
when(sshConfig.existsSync()).thenReturn(true);
when(devFinder.absolute).thenReturn(devFinder);
when(sshConfig.absolute).thenReturn(sshConfig);
});
......
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