From 8f07f831e937aa27ab95eb13f702646b4b951a99 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 18 Mar 2008 13:03:21 +0000
Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=9Ctty=E2=80=9D=20parameter=20to=20?=
 =?UTF-8?q?SshRunner.BuildCmd?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This allows callers to allocate a pseudo-TTY easily.

Reviewed-by: ultrotter
---
 lib/ssh.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/ssh.py b/lib/ssh.py
index 9af71f549..d4fc2174c 100644
--- a/lib/ssh.py
+++ b/lib/ssh.py
@@ -90,7 +90,8 @@ class SshRunner:
   """Wrapper for SSH commands.
 
   """
-  def BuildCmd(self, hostname, user, command, batch=True, ask_key=False):
+  def BuildCmd(self, hostname, user, command, batch=True, ask_key=False,
+               tty=False):
     """Build an ssh command to execute a command on a remote node.
 
     Args:
@@ -114,6 +115,8 @@ class SshRunner:
       argv.extend(BATCH_MODE_OPTS)
     elif ask_key:
       argv.extend(ASK_KEY_OPTS)
+    if tty:
+      argv.append("-t")
     argv.extend(["%s@%s" % (user, hostname), command])
     return argv
 
-- 
GitLab