more ui-as-code (#35393)

* more ui-as-code

* address review comments
This commit is contained in:
Alexandre Ardhuin
2019-07-02 21:11:56 +02:00
committed by GitHub
parent e2a55fe83f
commit 758009ba70
62 changed files with 676 additions and 774 deletions

View File

@@ -606,24 +606,21 @@ class _SshPortForwarder implements PortForwarder {
// IPv6 interface, it cannot be used to connect to a websocket.
final String formattedForwardingUrl =
'${localSocket.port}:$_ipv4Loopback:$remotePort';
final List<String> command = <String>['ssh'];
if (isIpV6) {
command.add('-6');
}
if (sshConfigPath != null) {
command.addAll(<String>['-F', sshConfigPath]);
}
final String targetAddress =
isIpV6 && interface.isNotEmpty ? '$address%$interface' : address;
const String dummyRemoteCommand = 'true';
command.addAll(<String>[
final List<String> command = <String>[
'ssh',
if (isIpV6) '-6',
if (sshConfigPath != null)
...<String>['-F', sshConfigPath],
'-nNT',
'-f',
'-L',
formattedForwardingUrl,
targetAddress,
dummyRemoteCommand,
]);
];
_log.fine("_SshPortForwarder running '${command.join(' ')}'");
// Must await for the port forwarding function to completer here, as
// forwarding must be completed before surfacing VM events (as the user may
@@ -649,20 +646,19 @@ class _SshPortForwarder implements PortForwarder {
// uses the IPv4 loopback.
final String formattedForwardingUrl =
'${_localSocket.port}:$_ipv4Loopback:$_remotePort';
final List<String> command = <String>['ssh'];
final String targetAddress = _ipV6 && _interface.isNotEmpty
? '$_remoteAddress%$_interface'
: _remoteAddress;
if (_sshConfigPath != null) {
command.addAll(<String>['-F', _sshConfigPath]);
}
command.addAll(<String>[
final List<String> command = <String>[
'ssh',
if (_sshConfigPath != null)
...<String>['-F', _sshConfigPath],
'-O',
'cancel',
'-L',
formattedForwardingUrl,
targetAddress,
]);
];
_log.fine(
'Shutting down SSH forwarding with command: ${command.join(' ')}');
final ProcessResult result = await _processManager.run(command);

View File

@@ -82,18 +82,16 @@ class SshCommandRunner {
/// If the subprocess creating the SSH tunnel returns a nonzero exit status,
/// then an [SshCommandError] is raised.
Future<List<String>> run(String command) async {
final List<String> args = <String>['ssh'];
if (sshConfigPath != null) {
args.addAll(<String>['-F', sshConfigPath]);
}
if (isIpV6Address(address)) {
final String fullAddress =
interface.isEmpty ? address : '$address%$interface';
args.addAll(<String>['-6', fullAddress]);
} else {
args.add(address);
}
args.add(command);
final List<String> args = <String>[
'ssh',
if (sshConfigPath != null)
...<String>['-F', sshConfigPath],
if (isIpV6Address(address))
...<String>['-6', interface.isEmpty ? address : '$address%$interface']
else
address,
command,
];
_log.fine('Running command through SSH: ${args.join(' ')}');
final ProcessResult result = await _processManager.run(args);
if (result.exitCode != 0) {

View File

@@ -5,7 +5,7 @@ author: Flutter Authors <flutter-dev@googlegroups.com>
environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.2.0 <3.0.0"
sdk: ">=2.2.2 <3.0.0"
dependencies:
json_rpc_2: 2.1.0