Index: telemetry/telemetry/core/cros_interface.py |
diff --git a/telemetry/telemetry/core/cros_interface.py b/telemetry/telemetry/core/cros_interface.py |
index 7557fc2f01f007c98c82c994898e0f3211c81ca1..d7c1055b7b756add60c4504621848c787a519bb5 100644 |
--- a/telemetry/telemetry/core/cros_interface.py |
+++ b/telemetry/telemetry/core/cros_interface.py |
@@ -142,7 +142,7 @@ class CrOSInterface(object): |
def ssh_port(self): |
return self._ssh_port |
- def FormSSHCommandLine(self, args, extra_ssh_args=None): |
+ def FormSSHCommandLine(self, args, extra_ssh_args=None, port_forward=False): |
"""Constructs a subprocess-suitable command line for `ssh'. |
""" |
if self.local: |
@@ -152,8 +152,12 @@ class CrOSInterface(object): |
# connection to run remote commands (crbug.com/239607). |
return ['sh', '-c', " ".join(args)] |
- full_args = ['ssh', '-o ForwardX11=no', '-o ForwardX11Trusted=no', '-n', |
- '-S', self._ssh_control_file] + self._ssh_args |
+ full_args = ['ssh', '-o ForwardX11=no', '-o ForwardX11Trusted=no', '-n'] |
+ # As remote port forwarding might conflict with the control socket |
+ # sharing, skip the control socket args if it is for remote port forwarding. |
+ if not port_forward: |
+ full_args += ['-S', self._ssh_control_file] |
+ full_args += self._ssh_args |
if self._ssh_identity is not None: |
full_args.extend(['-i', self._ssh_identity]) |
if extra_ssh_args: |