Skip to content

[custom-devices] default "forwardPortSuccessRegex" value does not match #97641

@mbriand

Description

@mbriand

With custom devices, the forwardPortSuccessRegex is used to check if the port forwarding of the observatory service was installed successfully, by looking for a match in the standard output of the ssh process installing the port forwarding.

The default value of this regex, when a new device is added with flutter custom-devices add is Linux. However, I do not understand how this value was selected, as it does not relate to the output generated on my host (OpenSSH_8.4p1 / Ubuntu 21.10). All I have in standard output is Pseudo-terminal will not be allocated because stdin is not a terminal., while port is correctly forwarded.

Is Linux supposed to be present in the output in some way ? @ardera, this was in #78113 and #82043, do you have more context ?

Suggested solution

I believe the solution could either be:

  • Using a value of forwardPortSuccessRegex that matches on all systems.
  • Ask the user for a sensible value of forwardPortSuccessRegex.

Implementation tentative

I've attached a patch below, working on my side. As I do not fully understand how the previous Linux value was supposed to work, it might break things, so I'm not opening a PR right now.

diff --git a/packages/flutter_tools/lib/src/commands/custom_devices.dart b/packages/flutter_tools/lib/src/commands/custom_devices.dart
index 4c144e1a35ac..a80226cfcba7 100644
--- a/packages/flutter_tools/lib/src/commands/custom_devices.dart
+++ b/packages/flutter_tools/lib/src/commands/custom_devices.dart
@@ -736,11 +736,12 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
           '-o', 'ExitOnForwardFailure=yes',
           if (ipv6) '-6',
           '-L', '$formattedLoopbackIp:\${hostPort}:$formattedLoopbackIp:\${devicePort}',
-          sshTarget
+          sshTarget,
+	  "echo 'Port forwarding success'; read"
         ]
         : null,
       forwardPortSuccessRegex: usePortForwarding
-        ? RegExp('Linux')
+        ? RegExp('Port forwarding success')
         : null,
 
       screenshotCommand: screenshotCommand.isNotEmpty
-- 

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to Flutterplatform-linuxBuilding on or for Linux specificallytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions