1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

Handle ssh output buffering better

This commit is contained in:
Ciaran Gultnieks 2013-01-22 16:11:39 +00:00
parent 6e87f82522
commit a404397014

View File

@ -216,8 +216,6 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
# Execute the build script...
print "Starting build..."
chan = sshs.get_transport().open_session()
stdoutf = chan.makefile('r')
stderrf = chan.makefile_stderr('r')
cmdline = 'python build.py --on-server'
if force:
cmdline += ' --force --test'
@ -226,9 +224,16 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
output = ''
error = ''
while not chan.exit_status_ready():
output += stdoutf.read()
error += stderrf.read()
while chan.recv_ready():
output += chan.recv(1024)
while chan.recv_stderr_ready():
error += chan.recv_stderr(1024)
print "...getting exit status"
returncode = chan.recv_exit_status()
while chan.recv_ready():
output += chan.recv(1024)
while chan.recv_stderr_ready():
error += chan.recv_stderr(1024)
if returncode != 0:
raise BuildException("Build.py failed on server for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())