mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[flutter_driver] Use async call to run SSH cmds. (#27577)
For `fuchsia_compat.dart` Instead of using `runSync`, use `run` to avoid deadlock when attempting to access specific resources like the Hub in Fuchsia. The specific example is that in Fuchsia, the `find` command is attempting to explore `out` which hasn't yet been serviced, as `find` is blocking on it, causing a deadlock.
This commit is contained in:
parent
e1cc0b75d0
commit
7da989f2c6
@ -49,7 +49,13 @@ class _DummySshCommandRunner implements SshCommandRunner {
|
||||
final List<String> splitCommand = command.split(' ');
|
||||
final String exe = splitCommand[0];
|
||||
final List<String> args = splitCommand.skip(1).toList();
|
||||
final ProcessResult r = Process.runSync(exe, args);
|
||||
// This needs to remain async in the event that this command attempts to
|
||||
// access something (like the hub) that requires interaction with this
|
||||
// process's event loop. A specific example is attempting to run `find`, a
|
||||
// synchronous command, on this own process's `out` directory. As `find`
|
||||
// will wait indefinitely for the `out` directory to be serviced, causing
|
||||
// a deadlock.
|
||||
final ProcessResult r = await Process.run(exe, args);
|
||||
return r.stdout.split('\n');
|
||||
} on ProcessException catch (e) {
|
||||
_log.warning("Error running '$command': $e");
|
||||
@ -93,7 +99,7 @@ class FuchsiaCompat {
|
||||
/// [FuchsiaRemoteConnection.stop].
|
||||
static Future<FuchsiaRemoteConnection> connect() async {
|
||||
FuchsiaCompat._init();
|
||||
return FuchsiaRemoteConnection
|
||||
.connectWithSshCommandRunner(_DummySshCommandRunner());
|
||||
return FuchsiaRemoteConnection.connectWithSshCommandRunner(
|
||||
_DummySshCommandRunner());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user