gerrit: Allow sending data with ssh command
Some commands like git-upload-pack expect data on stdin. These commands block further execution resulting in a blocked thread. This adds the possibility to optionally provide data for stdin of the command. Change-Id: I21fa2cb310a0472845d216da860e7ce06bd17825
This commit is contained in:
@@ -184,7 +184,7 @@ class Gerrit(object):
|
||||
key_filename=self.keyfile)
|
||||
self.client = client
|
||||
|
||||
def _ssh(self, command):
|
||||
def _ssh(self, command, stdin_data=None):
|
||||
if not self.client:
|
||||
self._open()
|
||||
|
||||
@@ -195,6 +195,9 @@ class Gerrit(object):
|
||||
self._open()
|
||||
stdin, stdout, stderr = self.client.exec_command(command)
|
||||
|
||||
if stdin_data:
|
||||
stdin.write(stdin_data)
|
||||
|
||||
out = stdout.read()
|
||||
self.log.debug("SSH received stdout:\n%s" % out)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user